ajay
ajay

Reputation: 1

problem in auto_increment in mysql?

iam getting a problem in auto increment that is . I declared auto increment and off set values as 5, 14 respectively in /etc/my.cnf file. and in creation of a table i declared auto increment.upto here every thing is fine. but wen iam ading a record it starts with 3 only.depending on auto_increment value the starting value in record is changing. it never starts with auto_increment value. please solve this problem. thanks in advance.

Upvotes: 0

Views: 420

Answers (3)

CloudyMarble
CloudyMarble

Reputation: 37576

What do you get when you read your Auto-increment vars using:

SHOW VARIABLES LIKE 'auto_inc%'

Do you get the Values you set before?

notice that if the value of auto_increment_offset is greater than that of auto_increment_increment, the value of auto_increment_offset is ignored.

Read the Manual

Upvotes: 0

Ibu
Ibu

Reputation: 43850

run this query on your table and you can set where the auto increment starts:

ALTER TABLE tbl AUTO_INCREMENT = 15;

or to any value you need

Upvotes: 0

Syed_Adeel
Syed_Adeel

Reputation: 430

auto increment always accept the greater value than the maximum present value in your table

Upvotes: 1

Related Questions