Reputation: 1539
This question might be a duplicate to these questions:
Anyhow, the solutions did not work for me, so it seems to be the same error but different cause.
Situation: In MySQL i have a table with one "id"-column (the primary key) which has the AUTO_INCREMENT
property set. Each time i try to insert a new row into that table i get the following error:
Failed to read auto-increment value from storage engine.
In the questions mentioned above the solution was to reset the auto-increment value with:
ALTER TABLE `table_name` AUTO_INCREMENT = 1
In my case this works fine as long as i don't reboot my computer. When i do, i'm getting the error again.
Additional Information:
Here is my CREATE TABLE
:
CREATE TABLE `producer` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
`setup_cost` double NOT NULL,
`delivery_time` int(5) NOT NULL,
`stock_delivery_time` int(5) NOT NULL,
`country` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
When executing SHOW TABLE STATUS
i have recognized something weird: Auto_increment
is set to 0 and Create_time
is set to "2014-01-20 17:00:46" although i have created the table about a month ago.
I also checked for corrupted Data with the MySQL command CHECK TABLE tablename EXTENDED
(thx @ToBe, see comments) but no errors were found.
Since I'm not very familiar with MySQL please tell me if I have forgot to provide any necessary information in the comments.
Any help is greatly appreciated, thanks in advance!
Upvotes: 1
Views: 9313
Reputation: 1539
I'm answering my own question because i solved it myself by dropping the table and recreating it. I had the same issue on some other tables and there i could solve it by only dropping the AUTO_INCREMENT from the column and redefining it.
Upvotes: 4