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