Failed to read auto-increment value from storage engine, Error Number: 1467

后端 未结 9 871
[愿得一人]
[愿得一人] 2020-12-16 02:54

When inserting data in mysql i get this error:

Error Number: 1467 Failed to read auto-increment value from storage engine

I don\'t now how to solve this i

相关标签:
9条回答
  • 2020-12-16 03:30

    I received this message too. My problem was that my table was not sorted by index. Try using the following:

    ALTER TABLE  `YOUR-TABLE` ORDER BY  `index` ;
    
    0 讨论(0)
  • 2020-12-16 03:33

    To add a little comment to kiddingmu's answer: it is not just a question of the number of digits, but also of the range of the datatype. If the column is INT(11), the 11 says that 11 digits are used for display; but this does not release the constraint that INT can only encode the range -2147483648:2147483647 when signed, and 0:4294967295 when unsigned.

    So: for an INT(11) column, an AUTO_INCREMENT of 10000000000 will work; an AUTO_INCREMENT of 90000000000 will not, despite it being 11 digits.

    If a larger range is needed, then another type should be used, like BIGINT.

    0 讨论(0)
  • 2020-12-16 03:33

    One possible explanation for this behavior is that the autoincrement value has reached the maximum value for the datatype, and its not possible for the database engine to increment it by one.

    I suggest you check the current value. One relatively easy way to do that is to run a SHOW CREATE TABLE mytable;, the table definition will show the current value. (You can also query the information_schema.tables view, to get the same information.)

    0 讨论(0)
  • 2020-12-16 03:33
    ps aux | grep mysql 
    sudo kill (your pid) 
    /etc/init.d/mysql restart
    
    0 讨论(0)
  • 2020-12-16 03:35

    As spencer7593 says, the autoincrement value has reached the maximum value for the datatype

    I just came to the problem.

    use the command SHOW CREATE TABLE tablename;, I get

    table name {
    `id` int(11) NOT NULL AUTO_INCREMENT,
     ......
    }ENGINE=InnoDB AUTO_INCREMENT=100000000000 DEFAULT CHARSET=utf8 
    

    You will see the length of 100000000000 is 12, beyond the limit 11.

    0 讨论(0)
  • 2020-12-16 03:37

    Check your database structure properly. I have also faced this problem, but I found some error in database structure. After fix the structure, problems were resolved.

    0 讨论(0)
提交回复
热议问题