While creating table in mysql I've set wrong name to primary key column.
ALTER TABLE `table_name` CHANGE COLUMN `old_id_name` `new_id_name` integer auto_increment primary key
After that I'm getting
Error message: Multiple primary key defined
So the question is how can I rename the column. Note that I don't want to change primary key to another but just rename it.
use query like this
ALTER TABLE `table_name` CHANGE `old_id_name` `new_id_name` INT(11) NOT NULL AUTO_INCREMENT;
it will change only the column name of primary key
Try this:
ALTER TABLE table_name CHANGE column old_name new_name int;
fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With