mysql 更改表的主键为auto_increment

Posted by bower on August 06, 2009
mysql

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

change the primary key for a table in mysql

创建:
mysql> create table ref (ref_id int unsigned not null, something varchar(30), primary key(ref_id));
更改:
mysql>alter table ref drop primary key , add column newcol int auto_increment PRIMARY KEY ;

分享到:人人网开心网腾讯微博新浪微博豆瓣分享腾讯空间百度搜藏腾讯书签

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word