mysql 创建数据库名称含横线报错问题解决方法

2017-09-13 10:29:04来源:oschina作者:杜鹏程人点击

分享
mysql> create database xxl-job;
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 '-job' at line 1
mysql> create database "xxl-job";
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 '"xxl-job"' at line 1
mysql> create database xxl/-job;
ERROR:
Unknown command '/-'.
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 '/-job' at line 1
mysql>
mysql>
mysql> create database `xxl-job`;
Query OK, 1 row affected (0.00 sec)

如上,


使用反引号把数据库名称括起来就可以了。

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台