I have about 30 tables in my database:
table1 table2 table3 table4 table5 etc.
I want all tables to use AUTO_INCREMENT=1, how do I modify the tables?
Here is the sample DDL of one of the tables. I have never defined AUTO_INCREMENT in any of the tables, it is fetching the value by default.
CREATE TABLE `amenities` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
To change the value of the AUTO_INCREMENT counter to be used for new rows, do this:
To update all your 31 tables you can use this php script: