MySQL – Set Auto-Increment Increment by 10 for One Table

auto-incrementMySQL

Is it possible to add auto-increment-increment by 10 for only one table in mysql?

I have a testing db that has a lot of tables that do not abide by the auto-increment-increment of 10. I won't want to mess up my testing rig.

The production server has auto-increment-increment of 10.

Best Answer

According to the MySQL documentation, you can't set custom auto-increment value for a specific table.

It is not possible to restrict the effects of these two variables to a single table; these variables control the behavior of all AUTO_INCREMENT columns in all tables on the MySQL server.

However, this value has both global and session level effect. You may set it for session level and can perform required tests. And the changes will not persist after restarting your database server.

Reference: auto_increment_increment