The CREATE DATABASE statement creates a DB with the specified name on the MySQL instance, and when the created database itself exists and does not specify an if NOT EXISTS clause, the statement creating the database will error.
The created database creates a directory of its own files in the same directory as the data file, which is used to contain the table files that are created later. Of course, you can also create a folder in the data directory through MKDIR's operating system commands, and MySQL will recognize it as a database and be seen when you execute the show databases command .
mysql> CREATE database test3; # #创建数据库成功
Query OK, 1 row Affected (0.00 sec)
mysql> CREATE database test3; # #再次创建数据库失败
ERROR 1007 (HY000): Can ' t create database ' test3 '; Database exists
mysql> CREATE database if not exists test3; # #语句执行成功
Query OK, 1 row affected, 1 Warning (0.00 sec)
mysql> use test3; # #切换到test3数据库
Most of the databases used by internet companies are MySQL , want to stand out from the many IT workers, need to have advanced technology, learning to add value is essential. The way of learning is your insistence. the old boy education MySQL DBA course, after several updates the course, put an end to the paper , the whole enterprise real case unifies the theory instruction, wants to study the MySQL dba 's knowledge deeply, Can pay attention to the old boy education.
Create database statement about MySQL DBA Weekend learning