Cannot change auto_increment_increment value in mysql

I have a database whose one table began to automatically increment values ​​by 10. I never set it explicitly, but for some reason it does. I tried resetting auto_increment_increment to 1 using the following:

SET @@auto_increment_increment=1; 

But that does not change! I tried to do this using the command line, but it still doesn’t.

One more thing, on my local machine, auto_increment works fine (it is set to 1), but this is a problem on my server. When I used mysql on the command line, I logged in as the "root user".

Can anyone suggest what could be wrong with my database? Thanks for the help.

+4
source share
2 answers

Thanks to WoLpH for your help.

I finally found out what caused this problem! The value of auto_increment_increment has been changed in the file . \ Xampp \ mysql \ bin \ my.ini . That is why, even when I tried to replace it using the following query, it did not change:

 SET @@auto_increment_increment=1; 

Hope this helps someone.

+3
source

Are you sure this is the value of auto increase, which is the problem here? If you insert a row into a transaction and rollbacks, it also grows, and you will never get an identifier.

If your code somehow inserts a lot of lines and rolls them all back, you will also see this behavior.

0
source

Source: https://habr.com/ru/post/1414646/


All Articles