zoukankan      html  css  js  c++  java
  • MySql 执行语句错误 Err] 1064

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

  • 相关阅读:
    springboot 的常用操作
    springboot 项目中注解的基本使用
    springboot中starters 提供的常用的依赖
    在搭建Springboot的项目 之前 maven 的基本的配置
    国际区号+手机号正则校验
    java实现Multipart/form-data
    Thumbnailator压缩图片
    Spring框架整合多数据源 Mysql+oracle
    微信支付body中文乱码的情况
    el表达式的值里面带单双引号的情况
  • 原文地址:https://www.cnblogs.com/smile-wei/p/5740111.html
Copyright © 2011-2022 走看看