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)
如上,
使用反引号把数据库名称括起来就可以了。