7

#1467 - Failed to read auto-increment value from storage engine

 2 years ago
source link: https://ttys3.dev/post/failed-to-read-auto-increment-value-from-storage-engine/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

#1467 - Failed to read auto-increment value from storage engine

2021-09-04 :: 荒野無燈 :: Mod 2021-09-07(e4a0587)
#mysql  #mariadb 

September 7, 2021

插入数据时自增id出错了

INSERT INTO `xxxx` (`id`, `name`, `url`, `info`) VALUES (NULL, 'blahblahblah', '/xxxx', '');
#1467 - Failed to read auto-increment value from storage engine

看看表的自增id现在是多少: ```SHOW CREATE TABLE xxxx`

CREATE TABLE `xxxx` (
  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(128) NOT NULL DEFAULT '',
  `url` varchar(255) NOT NULL DEFAULT '',
  `info` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=utf8mb4

WTF ? AUTO_INCREMENT=18446744073709551615? AUTO_INCREMENT 的值已经爆掉了.

至于为什么爆掉了,原因不明. 有可能是以前从 MyISAM 转 InnoDB 的时候出问题了? 不清楚.

修正下表的自增id:

ALTER TABLE `xxxx` AUTO_INCREMENT=(SELECT MAX(id) FROM xxxx);

然后再执行插入操作就行了.

Refs: https://stackoverflow.com/a/31557413/13267147


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK