centos mysql无法删除数据库

系统版本是CentOS Linux release 7.4.1708 (Core)

数据库版本mysql  Ver 14.14 Distrib 5.6.39

在执行drop database ga-shangwu;命令后报错如下:

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

解决办法:

drop database `ga-shangwu`;  用反引号将数据库引起来就可以了

问题原因:

数据库名字使用了mysql保留字:-

原文地址:https://www.cnblogs.com/leon2659/p/9473996.html