1

I want auto_increment to increment by 1 each time I insert a row. It doesn't matter if I later delete a row in the middle, I always want it to increment by 1.

The problem is that MySQL keeps incrementing by 10. It goes from 1 to 11, to etc.

I've adjusted auto_increment, auto_increment_increment, auto_increment_offset, with no avail by setting them to 1 or 0 where appropriate.

EDIT:

These were the actions:

SET @@auto_increment_offset=1

ALTER TABLE posts AUTO_INCREMENT = 0 or 1

SET @@auto_increment_increment=1;

Also, i am using the MYISAM engine for this particular table, though it appears to be happening to another table without that engine. The reason i am using MYISAM is because it allows for auto-inc on multiple indexes.

And i can't restart my db because it's running on a shared server on heroku. I also don't understand how this is a duplicate if it hasn't been resolved elsewhere.

user1831680
  • 73
  • 1
  • 8
  • 2
    What platform are you on? This is highly unusual behavior. – L0j1k Feb 25 '13 at 11:00
  • 2
    Take a look at this: http://stackoverflow.com/questions/206751/mysql-autoincrement-column-jumps-by-10-why Also, have you tried changing those settings in the configuration, and then restarting the MySQL service? Not just a restart, but a complete `service mysqld stop` and `service mysqld start`? – L0j1k Feb 25 '13 at 11:01
  • 2
    Tip: when you search the internet, add "mysql" and your server version to the search terms, so you can get results from the MySQL manual, e.g.: [mysql 5.5 autoincrement](https://www.google.com/search?q=mysql+5.5+autoincrement). – Álvaro González Feb 25 '13 at 11:06
  • Where did you adjust those numbers? CNF file or? – N.B. Feb 25 '13 at 11:08
  • Good question, but please try to keep titles functional - titles are simply a relevant summary to encourage people to click on your question. See my edit. – halfer Feb 25 '13 at 11:14
  • Please can you show your sql and results – cja Feb 25 '13 at 15:47

0 Answers0