Failed to read auto-increment value from storage engine

INSERT INTO `sdb_order_items` .....

失败: ERROR 1062 (23000): Duplicate entry '16777215' for key 'PRIMARY'


alter table `sdb_order_items` auto_increment=16777220;

再执行那个INSERT还不行

失败:ERROR 1467 (HY000): Failed to read auto-increment value from storage engine

后来发现 主键自增字段  长度不够了  之前是 mediumint(8)  unsigned       无符号的范围是0到16777215

modify成其它类型就可以了 

为防后患  这里直接alter table `sdb_order_items` modify  `item_id` bigint(25) unsigned NOT NULL AUTO_INCREMENT


你可能感兴趣的:(mysql,mysql,auto-increment)