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 中设置如图:把前面对号去掉就可以

时间: 2024-10-10 04:30:07

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的相关文章

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

报错如图: 最开始其实我的列名tname和tsubject分别叫name和subject,后来看到网上有说这个报错可能是数据库建表的时候使用了mysql的关键词,我就只把name改了.后来还是这个问题,百思不得其解. 后来同学告诉我说老师帮她检查SQL语句的问题时都是把php程序里的SQL语句先复制到mysql里面去执行看是不是数据库的问题的. 太tm机智了,我怎么没想到呢,姜还是老的辣.复制过去一看,怎么subject也是关键词啊! 很有信心的改掉以后等待正确结果,但是竟然还是这个错... 没

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

[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 如果不是符号中英文切换的问题,那就是反引号写成单引号引起的  参考链接:https://blog.csdn.net/qq_27495157/article/details/80240156 原文地址:htt

[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL s

[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 at line 3 MySQL 5.6,Navicat For MySQL 10.0.10 中执行SQL语句时提示此错误,在CMD中执行SQL文件中的语句时提示以下错误: D:\Users\Aven>mys

插入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

插入一个很简单的sql语句时候,mysql一直报错: [SQL] INSERT INTO ORDER ( id, activity_id, order_type, phone, order_amount, order_state, pay_type)VALUES ( '4', '2121313', '1', '13552444989', '1', '1', '1' ) [Err] 1064 - You have an error in your SQL syntax; check the man

插入数据库失败([Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version)

报错信息如下: [SQL]INSERT INTO read VALUES(123, 456) [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 'read VALUES(123, 456)' at line 1 原因,read是数据库的关键字, 牢记,如果

C# Mysql 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 ????

有几年没用过MySql数据了,今天在使用C#访问MySql数据库时出现了一个小插曲. 错误提示: 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 ??? 当然,错误提示已经很明白的说明是sql的语法错误. 然而,我的sql 语句是 select count(*) from tab

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 '?,?,?,?)'

使用?占位符写MYSQL查询语句,执行报错 1 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '?,?,?,?)' at line 1 2 at sun.ref

MySQLSyntaxErrorException: 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 ...

下面是我update数据库时打印出来的异常: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version

1.错误描述 org.hibernate.exception.SQLGrammarException: error executing work at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:80) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(