MySQL we have installed is a database management tool. What is really valuable is that data in a relational database exists in the form of tables, the aggregation of N tables becomes a database. Now let's take a look at the basic operations of the database.
There are only three points: Create, delete, and view
Create a database
Copy codeThe Code is as follows:
Mysql> create database school;
Query OK, 1 row affected (0.00 sec)
The create database statement is used to create a database.
The school is the name of the database, and the semicolon ends.
If the execution is successful, Query OK is displayed, and the execution time is also displayed.
When a database is available, the current database is usually viewed.
View Database
Copy codeThe Code is as follows:
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Performance_schema |
| School |
| Test |
+ -------------------- +
Rows in set (0.00 sec)
In this way, the created database is displayed, where school is the one just created
The remaining items exist by default. Do not change them.
Test is used for testing and can be deleted.
Delete Database
Copy codeThe Code is as follows:
Mysql> drop database school;
Query OK, 0 rows affected (0.00 sec)
It's easy to delete. Just run the drop database Command.
Next, you can use show databases to view the results. Note that the semicolon should not be forgotten after the statement. In practice, we operate more than databases, but tables in the database. Therefore, the content here is very simple.