Mysql修改自增主键的起始值及查询自增主键的下一个值

MySQL [xxx_mall]> alter table shop_base_info  AUTO_INCREMENT=11000;
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

MySQL [xxx_mall]> SELECT
    -> auto_increment
    -> FROM
    -> information_schema.`TABLES`
    -> WHERE
    -> table_name = 'shop_base_info';
+----------------+
| auto_increment |
+----------------+
|          11001 |
+----------------+
1 rows in set (0.00 sec)

PS: 如果数据不足11000条,不影响前面的数据 ; 如果数据大于11000,则设置无效

猜你喜欢

转载自www.cnblogs.com/xuzhujack/p/10975663.html
今日推荐