First, create a database
The SQL syntax format for creating databases in MySQL is:
CREATE database name;
Where the database name cannot have the same name as the database that already exists. To create a database test_db:
You can view the definition of a database by using the following statement:
SHOW CREATE database name (\g);
where "\g" means formatted output, which can be added without adding. As shown in the following:
You can use the following how to view all currently existing databases:
SHOW DATABASES;
Second, delete the database
The SQL syntax format for deleting a database in MySQL is:
DROP database name;
As shown, delete the test_db database:
After you delete the database and then view the definition of the database, you will get an error:
Note : be careful when using the delete database command because MySQL does not give any reminder confirmation when the command is executed, and after the database is deleted, all data tables and data stored in the database are deleted together and cannot be recovered.
MySQL basic operation of the database