Lab01 Mysql
Lab01 Mysql
I. Install
All downloads for MySQL are located at MySQL Downloads:
https://www.mysql.com/downloads/
Pick the suitable version of MySQL Community Server you will be running on
your platform and install.
Or install from xampp, lampp …
https://www.apachefriends.org/index.html
After you have logged into the MySQL server using the mysql client, the
following step describes how to create and delete databases.
CREATE DATABASE [IF NOT EXISTS] database_name;
Note: SQL statements ending with asterisk; or \g, \G and press the Enter key.
The CREATE DATABASE statement will create a database called
“database_name”. IF NOT EXISTS is an option to avoid errors if a database
with the same name exists. If it already exists, the command will not be
executed.
USE database_name;
To select a database that you intend to work.
Database deletion means deleting the physical database, all data and related
objects. Like the CREATE DATABASE statement, the IF EXIST option will not
execute the command DELETE if the database does not exist
V. Questions
1. How to change the default port of MySQL server to 3307 and
connect to MySQL server at this port?
2. How to move the data directory of MySQL to another directory
and reconfigure the configuration file to redirect to new data
directory.
3. Write the correct SQL statement to list all the exsisting databases
in MySQL.
4. Write the correct SQL statement to create a new database called
“my_database”.
5. Write the correct SQL statement to delete the database
“my_database”.