When you create a database mysql: ERROR 1064 (42000): You have an error in your SQL syntax;

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/zp357252539/article/details/90700923

Today, when you create a database in mysql database, reported the following errors:

mysql> CREATE DATABASE IF NOT EXISTS web-flash DEFAULT charset utf8 COLLATE utf8_general_ci;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
 for the right syntax to use near '-flash DEFAULT charset utf8 COLLATE utf8_general_ci' at line 1
mysql> CREATE DATABASE IF NOT EXISTS web_flash DEFAULT charset utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.13 sec)

Later discovered that the database name if there are special characters "-", there will be above tips, "-" to "_" on it

 

 

Guess you like

Origin blog.csdn.net/zp357252539/article/details/90700923