MySql 执行语句错误 Err] 1064 - 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


关于用Power Designer 生成sql文件出现 错误  [Err] 1064 - 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 'int not null auto_increment comment '用户id',  

的解决办法

 

sql语句如下 

 1 drop table if exists tb_users;
 2 
 3 /*==============================================================*/
 4 /* Table: tb_users                                              */
 5 /*==============================================================*/
 6 create table tb_users
 7 (
 8    userid               national int not null auto_increment comment '用户id',
 9    orgid                int comment '组织id',
10    username             varchar(50) not null comment '姓名',
11    account              varchar(50) comment '账号',
12    password             varchar(100) comment '密码',
13    sex                  varchar(10) comment '性别',
14    phone                varchar(100) comment '电话',
15    duties               varchar(100) comment '岗位职务',
16    mail                 varchar(100) comment '邮箱',
17    personstatus         char default '0' comment '人员状态(0在职,1离职)',
18    accountstatus        char default '0' comment '账号状态(0正常,1注销)',
19    enabletime           datetime comment '账号登录有效时间',
20    newaddtime           datetime comment '新增时间',
21    updatetime           datetime comment '更新时间',
22    operater             varchar(36) comment '操作人',
23    lastloadtime         datetime comment '最后登录时间',
24    bz1                  varchar(200) comment '备注1',
25    bz2                  varchar(200) comment '备注2',
26    bz3                  varchar(200) comment '备注3',
27    primary key (userid)
28 );
29 
30 alter table tb_users comment '用户表';
31 
32 alter table tb_users add constraint FK_Reference_11 foreign key (orgid)
33       references tb_organize (orgid) on delete restrict on update restrict;

执行后出现如下错误,

[Err] 1064 - 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 'int not null auto_increment comment '用户id',
   orgid                int com' at line 6

  解决办法:

是否发现执行的sql语句中多了个national关键字,把这个关键字去掉就可以。

在podwer designer 中设置如图:把前面对号去掉就可以

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 解决:[Err] 1064 - 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 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 php"> [Err] 1064 - 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 ''

php Mysql语法错误之> 1064 - 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' 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 '11. set password for 'root'@'localhost' 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 '"id", 1064 - 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 'groups)VALUES('1','hh','hh@163.com','Boss')' at line 1 Django进行数据迁移时,报错:(1064, "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 '(6) NOT NULL)' at line 1") SQL语句报错:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near MySql 执行语句错误:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to usenear 'bookName like '%Java%'' at line 1

 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM