创建一张表 t20
mysql> create table t20( id int primary key auto_increment, name char(16) );
Query OK, 0 rows affected (0.01 sec)
mysql> desc t20;
+-------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | char(16) | YES | | NULL | |
+-------+----------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
修改自增字段为3 下次插入新纪录 从3开始
mysql> alter table t20 auto_increment=3;
Query OK, 0 rows affected (0.00 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> show create table t20\G;
*************************** 1. row ***************************