0

How do I make the change of the column ID in the table to ints and auto-increment through phpmyadmin?

Thanks

merrill
  • 593
  • 5
  • 14
  • 34

3 Answers3

1

Try this:

ALTER TABLE your_table
CHANGE ID ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
Marco
  • 56,740
  • 14
  • 129
  • 152
1

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;
Devart
  • 119,203
  • 23
  • 166
  • 186
0

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

Akhil Thayyil
  • 9,263
  • 6
  • 34
  • 48