删除带中划线的数据库

数据名带了个中划线,删库时报语法错误:

mysql> drop database api;

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

加个单引号,再执行删除命令,仍然不行:

mysql> drop database 'api';

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

解决:使用反撇号框选数据库名,可以完成命令执行:

mysql> drop database `api`;

Query OK, 77 rows affected (2.38 sec)

结束。

posted @ 2020-10-25 14:16  巴州夜雨  阅读(226)  评论(0编辑  收藏  举报