Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add auto-increment to column in mysql database using phpmyadmin?

I've been trying to add auto-increment to one of my columns (basically an ID) but I can't find the auto-increment option for my column. Any idea where it is?

like image 481
SKLAK Avatar asked Oct 17 '13 18:10

SKLAK


People also ask

How do I make a column auto increment in MySQL?

In MySQL, the syntax to change the starting value for an AUTO_INCREMENT column using the ALTER TABLE statement is: ALTER TABLE table_name AUTO_INCREMENT = start_value; table_name.

Can I add auto increment to existing column MySQL?

You can add auto_increment to a column in MySQL database with the help of ALTER command.

What is AI in phpMyAdmin?

In phpMyAdmin, if you set up a field in your table to auto increment, and then insert a row and set that field's value to 10000, it will continue from there.


1 Answers

You can add it like this

ALTER TABLE your_table
MODIFY some_column INT NOT NULL AUTO_INCREMENT;
like image 108
juergen d Avatar answered Oct 02 '22 14:10

juergen d