在mysql中创建数据库时出错ERROR 1064(42000)

时间:2017-07-05 02:22:28

标签: mysql

在mysql交互式终端中,当我想创建一个新的数据库时

mysql> create database albedo-new;
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 '-new' at line 1
mysql> create database 'albedo-new';
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 ''albedo-new'' at line 1

我不确定mysql是否允许在数据库名称中使用' - '。

1 个答案:

答案 0 :(得分:8)

mysql确实允许数据库名称中的连字符

使用反引号

create database `albedo-new`