mysql> create database d-d;

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

 

1064报错:该错误一般出现在表名或者字段名设计过程中出现了mysql关键字导致的。问题确定是数据库名字的错误,我把横杠去掉以后就可以。

 

尝试:

create database [d-d];

create database 'd-d';

create database ”d-d“;

create database d\-d;

均报错:
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 '[d-d]' at line 1

解决:create database `d-d`;    加反引号

 

mysql> create database `d-d`;
Query OK, 1 row affected (0.00 sec)

相关文章:

  • 2021-08-03
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-12-21
  • 2021-11-10
  • 2021-11-26
  • 2021-11-22
猜你喜欢
  • 2022-01-03
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2021-12-21
相关资源
相似解决方案