如何删除包含“ - ”符号的数据库?
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| vms01 |
| vms-0.1.0 |
+--------------------+
4 rows in set (0.00 sec)
mysql> drop database vms-0.1.0;
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 n
ear '-0.1.0' at line 1
mysql>
答案 0 :(得分:22)
您可以使用反引号引用标识符(例如表名和列名):
drop database `vms-0.1.0`
有关详细信息,请参阅文档:Schema Object Names。
标识符引号字符是反引号(“`”):