-1

I have more than 20 tables in my schema. Every table has auto_increment id and its adding value by 1 like 1,2,3 but only single table called "member_table" is adding by 2 like 2,4,6.

Even I have done

SET GLOBAL auto_increment_increment=1;
SET GLOBAL auto_increment_offset  = 1;

But still the same table adding by 2.

Why this happen ? I ever seen like this problem.

MMMMS
  • 2,179
  • 9
  • 43
  • 83
  • 1
    How do you add values? Post your code. Maybe you add twice and second row is discarded – Lukasz Szozda Aug 12 '17 at 07:20
  • 1
    Second do you restart server after setting `SET GLOBAL` or tried inserting using new connection? – Lukasz Szozda Aug 12 '17 at 07:23
  • @lad2025 I dint restart the server but i Just closed the workbench and opened and inserted. – MMMMS Aug 12 '17 at 07:33
  • 2
    It can happen if the code tries to insert a row twice and an `UNIQUE` index prevents the second insertion. The auto incremented column is incremented on each `INSERT` attempt, no matter if the `INSERT` is successful or not. – axiac Aug 12 '17 at 07:36

1 Answers1

0

try this,

SET @@auto_increment_increment=1; SET @@auto_increment_offset=1;

Sanjay Kumaar
  • 690
  • 7
  • 17