Quantcast
Channel: How can I rename primary key constraint in MySQL? - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by Syed Haris Ali Ghaznavi for How can I rename primary key constraint...

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

View Article



How can I rename primary key constraint in MySQL?

I have several tables with primary keys. I did not give these primary keys constraints any name. Is it possible to give them name now and how? I am using MySQL 5.7.

View Article
Browsing latest articles
Browse All 2 View Live


Latest Images