Today, I've the same error when I tried to insert a record into a table named mytablename:
ERROR 1467 (HY000): Failed to read auto-increment value from storage engine
In the table I've only 52269 records, max(id) = 52269.
I've tried following command under mysql command console, but nothing takes place, error persists:
#
# set AUTO_INCREMENT = max(id) + 1: not work:
#
ALTER TABLE mytablename AUTO_INCREMENT = 52270;
I must find another solution. When I do:
SHOW TABLE STATUS FROM mydatabase WHERE `name` LIKE 'mytablename' ;
It shows that my Auto_Increment value is 0, that is clearly in error, it must be greater or equal to 1.
I modified any colum in the table like:
ALTER TABLE mytablename CHANGE COLUMN mycharfield mycharfield varchar(255) DEFAULT NULL AFTER id;
I do again the show table status command,
Auto_Increment value has been automatically changed to 52270, that is good value.
All goes since then...