删除带中划线的数据库

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

mysql> drop database apigateway-ai;

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 ‘apigateway-ai‘ at line 1

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

mysql> drop database ‘apigateway-ai‘;

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 ‘‘apigateway-ai‘‘ at line 1

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

mysql> drop database `apigateway-ai`;

Query OK, 77 rows affected (2.38 sec)

结束。

删除带中划线的数据库

上一篇:[LeetCode] 1286. Iterator for Combination


下一篇:连接数据库报错/找不到org.apache下的包/import org.apache报错