Mysql錯誤:Failed to read auto-increment value from storage eng

來源:互聯網
上載者:User

有一個MYSQL的EVENT從昨天晚上開始就一直執行失敗:event execution failed.

沒有提示任何具體的錯誤資訊,手工執行時間的代碼後,報錯:Failed to read auto-increment value from storage engine Query

這才發現,我的表中有一個自增的欄位:`id` int(4) not null auto_increment,而且通過  show create table table_name 可以看到,自增的數字已經達到 2147483647 了。將這個數字轉換為16進位,就是0x0FFFFFF。就是說已經達到了這個欄位所能儲存的最大值,所以報這個錯誤。

經過修改程式,將DELETE整表的語句換位了TRUNCATE,這樣每次自增欄位都會清零,而且對於大資料表,會刪除的非常快。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.