mysql创建表设置表主键id从1开始自增的解决方案(mysql的建表)怎么可以错过

随心笔谈11个月前发布 admin
85 0

create table if not exists `sys_user`
(
`id` bigint(20) not null auto_increment PRIMARY KEY comment ‘主键’ ,
`opend_id` varchar(256) DEFAULT null comment ‘微信用户唯一id’,
`account_number` varchar(256) DEFAULT null comment’账号’,
`username` varchar(256) not null DEFAULT ” comment ‘用户名’,
`password` varchar(256) comment ‘密码’,
`nick_name` varchar(256) DEFAULT null comment ‘昵称’,
`gender` varchar(25) DEFAULT null comment ‘性别’,
`phone` varchar(256) DEFAULT null comment ‘手机号’,
`role` varchar(10) default ‘0’ not null comment ‘角色,0为普通用户,1为会员’,
`age` varchar(256) not null DEFAULT’110’comment ‘年龄’,
`user_status` varchar(25) default ‘0’ not null comment ‘状态’,
`update_time` datetime not NULL DEFAULT CURRENT_TIMESTAMP comment ‘更新时间’,
`create_time` datetime not NULL DEFAULT CURRENT_TIMESTAMP comment ‘创建时间’,
`is_deleted` tinyint default 0 not null comment ‘是否删除(0-未删, 1-已删)’,
`email` varchar(256) DEFAULT null comment ‘邮箱’,
`avatar` varchar(256) not null DEFAULT ‘https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaG
T4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132’ comment ‘头像图片’,
`city` varchar(50) DEFAULT ‘北京’ comment ‘城市’,
`province` varchar(50) DEFAULT null comment ‘省份’,
`country` varchar(50) comment ‘国家’

) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 comment ‘用户表信息’;

© 版权声明

相关文章