请问你MYSQL版本,也许是版本问题
请看以下说明:
The following list tells what you have to watch out for when upgrading to Version 3.23:AUTO_INCREMENT will not work with negative numbers. The reason for this is that negative numbers caused problems when wrapping from -1 to 0. AUTO_INCREMENT for MyISAM tables is now handled at a lower level and is much faster than before. For MyISAM tables old numbers are also not reused anymore, even if you delete some rows from the table.
请看以下说明:
The following list tells what you have to watch out for when upgrading to Version 3.23:AUTO_INCREMENT will not work with negative numbers. The reason for this is that negative numbers caused problems when wrapping from -1 to 0. AUTO_INCREMENT for MyISAM tables is now handled at a lower level and is much faster than before. For MyISAM tables old numbers are also not reused anymore, even if you delete some rows from the table.
解决方案 »
- 如何修改mysql主键(id)的值为自增
- mysql ID自增列,但是insert into 时,不填写ID列不行!填下去就显示重复!
- 谁帮我讲讲
- MYSQL如何获取数据文件所在目录?
- Mysql::Error: #HY000Can't create/write to file 'E:\mysql\data\--install\#sql_ba8_0.MYI' (Errcode: 2): SHOW FIELDS FROM `composer
- 怎么把一个浮点数变成整数啊
- mysql lock
- mysql读写分离如何实现
- VS2010连接mysql5.0.96
- Mysql自定义函数执行时间与不封装时执行时间差别很大,求解
- 在linux 下把一个表的某个字段改类型,怎么改阿?alter table cruit add qq varchar(50);
- 付费,求网页制作合作伙伴(哈尔滨),
把你的id列删除
alter table tablename drop id
然后在重新加入id列
alter table tablename add id int(11) unsigned not null auto_increment primary key
这样默认加的id在最后,如果你想加在最前面这样:
alter table tablename add id int(11) unsigned not null auto_increment primary key first
如果你想把该列加在某列的后面这样做:
alter table tablename add id int(11) unsigned not null auto_increment primary key after columnps: auto_increment and unsigned 两个属性值用于整数列。
ALTER TABLE table1 AUTO_INCREMENT=1;
所以,再没有办法加一了。
最好的办法可能也只有COPY一个一样的表,然后改名。