Reputation: 591
How do I make the change of the column ID in the table to ints and auto-increment through phpmyadmin?
Thanks
Upvotes: 0
Views: 115
Reputation: 121902
If there is no primary key, try this statement -
ALTER TABLE table
CHANGE COLUMN id id INT(11) NOT NULL AUTO_INCREMENT,
ADD PRIMARY KEY (id);
Otherwise, you can run a script like this -
ALTER TABLE table
CHANGE COLUMN id id INT(11) NOT NULL AUTO_INCREMENT;
Upvotes: 1
Reputation: 9403
Do the following steps :
1) Make the datatype of columns for autoincrement as BIGINT 2) Make the same column as primary key. 3) Then add the auto inrement option as shown in the image AUTO INCREMENT
Upvotes: 0
Reputation: 57573
Try this:
ALTER TABLE your_table
CHANGE ID ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
Upvotes: 1