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 '123456' at line 1

这种错误往往是由于自己不小心造成的。
现在就把整个错误过程演绎一遍吧!!!

  1. 显示所有数据库
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| 123456             |
| 7weiblog           |
| mysql              |
| performance_schema |
+--------------------+
5 rows in set (0.00 sec)
  1. 看到123456这个数据库,想删除。
 mysql> drop database 123456;
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 '123456' at line 1
mysql> drop database '123456';
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 ''123456'' at line 1
mysql> drop database "123456";
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 '"123456"' at line 1

都出现错误
3. 改变数据库上面的引号,使其变成反向的123456

mysql> drop database `123456`;
Query OK, 0 rows affected (0.04 sec)

发现错误已经排除了

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐