Create database
After the installation of MySQL, several required databases will be automatically created in the data directory. You cansql
Statement to view all existing databases. The input statement is as follows.
sql
SHOW DATABASES;
As you can see, there are six databases in the database list. MySQL is a must. It describes the user‘s access rights. Users often use test database to do testing work. Other databases will be introduced in later chapters.
To create a database is to divide an area on the system disk for data storage and management
CREATE DATABASE database_name;
“database_ “Name” is the name of the database to be created, which cannot be the same as the existing database.
Create test database_ DB, the input statement is as follows.
CREATE DATABASE test_db;
After the database is created, it can be usedsql
View the definition of the database.
sql
SHOW CREATE DATABASE;
View the created database_ The definition of DB is as follows.
SHOW CREATE DATABASE test_db\G;
This work adoptsCC agreementReprint must indicate the author and the link of this article