Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a field in MySql auto-incrementing in PHPMyAdmin?

I created a field in my table and set it as the index but I can't get it to increase on it s own when a new item is added. How do I do make it do this through PHPMyAdmin?

like image 288
chustar Avatar asked Jan 12 '09 08:01

chustar


People also ask

How do you set a field as 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.

How do I automatically generate numbers in MySQL?

If you want to avoid writing sql, you can also do it in MySQL Workbench by right clicking on the table, choose "Alter Table ..." in the menu. When the table structure view opens, go to tab "Options" (on the lower bottom of the view), and set "Auto Increment" field to the value of the next autoincrement number.

What is the auto increment in MySQL?

Auto-increment allows a unique number to be generated automatically when a new record is inserted into a table. Often this is the primary key field that we would like to be created automatically every time a new record is inserted.


1 Answers

Select the A_I check box when creating/editing a column.

like image 152
Brian Fisher Avatar answered Oct 15 '22 20:10

Brian Fisher