gpt4 book ai didi

mysql - 由于非法字符而无法删除数据库

转载 作者:IT王子 更新时间:2023-10-29 00:38:56 26 4
gpt4 key购买 nike

如何删除包含“-”符号的数据库?

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>

最佳答案

您可以用反引号引用标识符(例如表名和列名):

drop database `vms-0.1.0`

有关详细信息,请参阅文档:Schema Object Names .

The identifier quote character is the backtick ("`"):

关于mysql - 由于非法字符而无法删除数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7618575/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com