標籤:one 一個 set 16px alt from table mysql orm
查詢表名為tableName的auto_increment值:複製代碼 代碼如下:SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_schema=‘photos‘ and table_name="tableName";
table_schema=‘photos‘ ---- 為所在資料庫名稱,沒有這個會把root中所有表格中表格名都為tableName的auto_increment 都調出來;
information_schema.tables 為固定的格式,sql進入命令終端----進入資料庫中操作的內容;
修改 test_user 庫 user 表 auto_increment為 10000mysql> alter table test_user.user auto_increment=10000;
Query OK, 0 rows affected (0.12 sec) Records: 0 Duplicates: 0 Warnings: 0
mysql> select auto_increment from information_schema.tables where table_schema=‘test_user‘ and table_name=‘user‘;
+----------------+
| auto_increment |
+----------------+
| 10000 |
+----------------+
1 row in set (0.04 sec)
修改 photos 庫 tf_user 表 auto_increment為 20
mysql> alter table `photos`.`tf_user` auto_increment=20;
Query OK, 0 rows affected (0.00 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> select auto_increment from information_schema.tables where table_schema=‘photos‘ and table_name=‘tf_user‘;
+----------------+
| auto_increment |
+----------------+
| 20 |
+----------------+
1 row in set (0.00 sec)
也可以在表格的 操作 中 查看 修改 下一個插入資料的 AUTO_INCREMENT;---這樣比較方便
http://blog.csdn.net/fdipzone/article/details/50421831
MySQL查詢和修改auto_increment的方法