Home >Database >Mysql Tutorial >What is the MySQL database creation statement?
Syntax: create database [if not exists] Database name [option]
mysql> create database stu; Query OK, 1 row affected (0.01 sec)
ERROR 1007 (HY000): Can't create database 'stu'; database exists
When creating the database, determine whether the database exists. If it does not exist, create it
Use backticks to change the database name Include it. ``
mysql> create database `create` mysql> create database `$%`; Query OK, 1 row affected (0.00 sec)
mysql> create database yudb charset=gbk;
If no encoding is specified, the database will default to the encoding specified when installing the database
The above is the detailed content of What is the MySQL database creation statement?. For more information, please follow other related articles on the PHP Chinese website!