Create a database

To create an MySQL database, the CREATE DATABASE name statement is used. For example, to create a database named testdb, we can use the following command:

mysql> CREATE DATABASE testdb;
Query OK, 1 row affected (0.01 sec)

We got the message indicating that our query was OK and the time it took to complete the command. We should see our new database in the output of the SHOW databases command:

mysql> SHOW databases;
| Database |
| information_schema |
| employees |
| mysql |
| performance_schema |
| sakila |
| sys |
| testdb |
| world |
8 rows in set (0.00 sec)

To work with our new database, we need to issue the USE testdb command:

mysql> USE testdb;
Database changed
Geek University 2021