mysql修改添加主键的方法:执行【alter table `test2` drop primary key ,add primary key ( `id` );】语句即可修改主键。
添加表字段
(推荐教程:mysql视频教程)
alter table table1 add transactor varchar(10) not null;alter table table1 add id int unsigned not null auto_increment primary key
修改主键
alter table `test2` drop primary key ,add primary key ( `id` )
增加索引
alter table `test2` add index ( `id` )alter table `category ` modify column `id` int(11) not null auto_increment first ,add primary key (`id`);
相关推荐:mysql教程
以上就是mysql怎么修改添加主键的详细内容。