I am having mysql table with one id field as auto-increment .
When I insert values to the table am getting error as
1467 - Failed to read auto-increment value from storage engine
Also the show table status
shows me that the field with auto increment has
18446744073709551615
as Auto_increment value.
What would be the issue can any one help me ....?
Basically this is a bug in MySQL that causes the problem but a work around is simple. The problem happens when the Auto-Increment value of a table grows beyond the limit. Just run this SQL query in MySQL to fix the bug. Table_name is the name of the table where you found the error while inserting data into.
Syntax for MySQL MySQL uses the AUTO_INCREMENT keyword to perform an auto-increment feature. By default, the starting value for AUTO_INCREMENT is 1, and it will increment by 1 for each new record. VALUES ('Lars','Monsen'); The SQL statement above would insert a new record into the "Persons" table.
What will happen if the MySQL AUTO_INCREMENT column reaches the upper limit of the data type? When the AUTO_INCREMENT column reaches the upper limit of data type then the subsequent effort to generate the sequence number fails.
Auto-increment allows a unique number to be generated automatically when a new record is inserted into a table. Often this is the primary key field that we would like to be created automatically every time a new record is inserted.
I had the same error but in my case I had about 1.5k records in the table. I fixed it by resetting the AUTO INCREMEN like that:
ALTER TABLE `table_name` AUTO_INCREMENT = 1
Problem could absolutely be that: convert 18446744073709551615 to hex and you'll find
$FFFF-FFFF-FFFF-FFFF.
If your field is an unsigned 64bit you reach its limit.
I started getting this error a couple of weeks back when running insert statements:
Duplicate entry '127' for key 'PRIMARY'
... even though my table was set to auto increment. I went in and changed the auto_increment value from 127 to 128 then I started getting this error:
1467 - Failed to read auto-increment value from storage engine
I eventually figured out that the table had been initially created with tinyint columns for the ID not standard ints ... so basically it couldn't comprehend numbers bigger than 127. I switched the column type to proper integers and that solved the issue.
Hope that helps someone :)
For my part, I made a dumb mistake. I had earlier altered my table and changed the name of the AUTO_INCREMENT
column from ID
to id
. So, given column names are case-sensitive, subsequent inserts couldn't find the original column.
Actually, you can simply alter the column to delete its auto_increament
property and set it as auto_increment
again. On my side, this way did work.
I go the same error. I just alter the table and increase the size of my auto increment field and then run the following query -
ALTER TABLE `table_name` AUTO_INCREMENT = 6221;
where 6221 is the last value of the filed with Auto_increment.
I experienced this error for the first time less than an hour ago. Resetting the auto_increment using a SQL statement in PHP MyAdmin failed. After looking for a solution I dropped the table and created a replacement. The error remained. Looking closer revealed the auto_increment was set to 0 even though I had specifically set the primary_key and auto_increment while creating the fields. Manually resetting auto_increment to 1, again using PHP MyAdmin, eliminated the error. Luckily for me I was only working with a 3-column table containing a few rows of test data.
I fixed it by removing the auto increment , saving table and then add auto increment again.
I had this problem today, too. I have a table with over two million rows and tried to add another 140K rows with LOAD DATA when this error occurred. I switched to the MyISAM engine and it all worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With