The project has encountered a problem, that is, data stored on a table when an error, "Failed to read auto-increment value from storage engine". In the structure of the table after a careful examination of the table auto_increment values are found in a very large value (18446744073709551615, is in the mysql bigint unsign value). So I manually set a value of 1 (ALTER TABLE target_table AUTO_INCREMENT = 1). But still does not work, the value has not changed.
Search for a lot of information online, a more consistent argument is that a mysql bug, need to upgrade the database. I have to trouble, do not upgrade my mysql. So would like to find other ways. I use the mysql console is phpmyadmin, accidentally discovered several operating options, such as optimization of the data table and on the table flush operation. Really played a role.
Concrete action is:
1. Select the destination table, click Operations, find the following Table maintenance list. Here are a few data sheet repair option.
2. Click Optimize Table, will implement the following sql statement: OPTIMIZE TABLE target_table.
3. After the return to Operations. Find Flush the table ("FLUSH"). Will implement the following sql statement:
FLUSH TABLE target_table.
At this point you can not AUTO_INCREMENT set to a large value can be received.
Project to use JPA, the database is automatically created, as to why, after you create the table AUTO_INCREMENT values will be set to a maximum value, which has still not clear. I do not know their own problems or database program, an error occurred.
Just make a record to facilitate future inquiries. If someone have similar problems, hope to exchange the next.
After the release of this article, I still did not find out the specific reasons, simply to test the database upgrade, the original version is 5.1.28, after upgrading the database version is 5.1.43. Once again rebuilt the database and found no problems. Really is a bug ah mysql database.