1:
`tmid` int(5) unsigned NOT NULL auto_increment,
就是用 INT(5) 来实现限制最大数值的2:
要使它重新记数
执行 DELETE FROM yourtablename;
`tmid` int(5) unsigned NOT NULL auto_increment,
就是用 INT(5) 来实现限制最大数值的2:
要使它重新记数
执行 DELETE FROM yourtablename;
该记录的自增编号通常是不会被再次使用的
(如果删除的是序列中最大的数,ISAM\BDB表会重用它 )而这条记录会空下来该记录的磁盘空间
为了有效利用磁盘空间,
MySQL 就会在新插入记录时将它占用
不过你可以在后期对数据库进行优化==================================
操作 1:D:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 4.0.11-gamma-max-nt-logType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> use test;
Database changed
mysql> SELECT * FROM t1;
+------+------+
| trid | name |
+------+------+
| 1 | a |
| 8 | b |
| 4 | c |
| 5 | d |
| 6 | e |
| 7 | a |
+------+------+
6 rows in set (0.00 sec)mysql>=====================================
操作 2:关闭 MySQL 服务程序
=====================================
操作 3:
优化数据库D:\mysql\bin>myisamchk d:/mysql/data/test/t1 -R 1
- Sorting records for MyISAM-table 'd:/mysql/data/test/t1'
Data records: 6 Deleted: 0
====================================
操作 4:重启 MySQL 服务程序
====================================
操作 5:D:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 4.0.11-gamma-max-nt-logType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> use test;
Database changed
mysql> SELECT * FROM t1;
+------+------+
| trid | name |
+------+------+
| 1 | a |
| 4 | c |
| 5 | d |
| 6 | e |
| 7 | a |
| 8 | b |
+------+------+
6 rows in set (0.00 sec)mysql>
- Sorting records for MyISAM-table 'd:/mysql/data/test/t1'
Data records: 6 Deleted: 0能不能把这个命令解释一下 我都不知道什么意思 -R 1 - sorting是什么东东
myisam-table 又是什么
然后在命令提示符下输入上述命令,d:/mysql/data/test/t1
表示在 d:/mysql/data/test/ 目录下的 表 t1 ,-R 1
以表定义的第一个索引顺序对表记录进行物理排序