How do I add auto_increment to an existing column of a MySQL table?
auto_increment
I think you want to MODIFY the column as described for the ALTER TABLE command. It might be something like this:
MODIFY
ALTER TABLE
ALTER TABLE users MODIFY id INTEGER NOT NULL AUTO_INCREMENT;
Before running above ensure that id column has a Primary index.
id
2.1m questions
2.1m answers
60 comments
57.0k users