how to add auto_increment in mysql existing table

I have a pre-existing table, containing ‘fname’, ‘lname’, ’email’, ‘password’ and ‘ip’. But now I want an auto-increment column id. However, when I enter:

ALTER TABLE `myTable` ADD COLUMN `id` INT AUTO_INCREMENT UNIQUE FIRST;

Leave a Reply