avatar
modify column to be a primary key before setting it to auto-increment MySQL

» First and foremost, change the data type of the id column in the users table to INT.

alter table users modify column id int;

» Conduct to add primary key constraint to the id column in the users table, ensuring each id value uniquely identifies a record.

alter table users add primary key (id);

» Finally, set the data type of the id column to INT and configures it to auto-increment, ensuring that each new row inserted into the table receives a unique identifier.

alter table users modify column id int auto_increment;
You need to login to do this manipulation!