« sitemap_gen 生成 Google Sitemaps 需要的网站地图 | Main | tar zxfk filename.tar.gz -k,--keep-old-files 不覆盖已存在文件 »
September 21, 2005
用 myisamchk 调整 mysql 的 auto_increment 自增列的 id
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。 https://windtear.net/archives/2005/09/21/000776.html http://windtear.net/archives/2005/09/21/000776.html 问题: mysql 的 auto_increment 列中的数据记录如果被删了 后面的值将不复用老的 文档: http://dev.mysql.com/doc/mysql/en/example-auto-increment.html 解决: myisamchk 可以解决这个问题 cd /var/lib/mysql/yourdb myisamchk -A yourtbl -A, --set-auto-increment[=value] Force auto_increment to start at this or higher value If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1. 然后下一次插入数据 auto_increment id 就变成当前最大值加1了 想得到连续 id 的愿望就实现了 |
Posted by windtear at September 21, 2005 7:20 PM