方案一:
CREATE TABLE IF NOT EXISTS user(
id INT UNSIGNED AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
sex VARCHAR(40) NOT NULL,
age INT(11),
PRIMARY KEY ( id )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
方案二:
alter table user modify id int auto_increment;
方案一:
CREATE TABLE IF NOT EXISTS user(
id INT UNSIGNED AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
sex VARCHAR(40) NOT NULL,
age INT(11),
PRIMARY KEY ( id )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
方案二:
alter table user modify id int auto_increment;