Current location - Loan Platform Complete Network - Big data management - Create a mysql table that already has an ID and set the ID as the primary key to auto-increment.
Create a mysql table that already has an ID and set the ID as the primary key to auto-increment.
DROP TABLE IF EXISTS `user`; (user is the name you already built)

CREATE TABLE `user` (

`id` int(11) NOT NULL auto_increment, (auto_increment controls the primary key since ever1)

`gid` int(11) default NULL,

`username` varchar(15) NOT NULL,

`password` varchar(15) NOT NULL,

PRIMARY KEY (`id`),----. >Set primary key

) ENGINE=InnoDB DEFAULT CHARSET=gb2312;

Or this

alter table table name modify id int auto_increment primary key