Quantcast
Channel: How can I rename primary key constraint in MySQL? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Syed Haris Ali Ghaznavi for How can I rename primary key constraint in MySQL?

$
0
0

Try this

ALTER TABLE `mytable`DROP PRIMARY KEY,CHANGE COLUMN oldname newname INT(11) DEFAULT NULL,ADD CONSTRAINT `mytable_newname_pk` PRIMARY KEY (`newname`) 

Viewing all articles
Browse latest Browse all 2

Trending Articles