MySQL 5.7 自增主键消失
MySQL 5.7 版本有个 bug:重启数据库后,自增主键会变为当前表中最大主键值 + 1;
1、创建表 test_bug;
2、insert 5 条数据(当前 auto_increment 值为 6);
3、delete 3 条数据(当前 auto_increment 值为 6);
4、重启 MySQL;
5、表 test_bug 的 auto_increment 值变为 3;
MySQL 5.7 版本有个 bug:重启数据库后,自增主键会变为当前表中最大主键值 + 1;
1、创建表 test_bug;
2、insert 5 条数据(当前 auto_increment 值为 6);
3、delete 3 条数据(当前 auto_increment 值为 6);
4、重启 MySQL;
5、表 test_bug 的 auto_increment 值变为 3;