MySQL AUTO_INCREMENT cannot be updated -
i have same problem justin, (can't alter mysql auto_increment) ie trying alter auto_increment value ignored.
i have used the:
alter table tablename auto_increment = 123;
before , worked fine. using innodb , have primary key on column set auto_increment.
create table `people` ( `perref` smallint(5) unsigned not null auto_increment, `surname` varchar(40) not null, primary key (`perref`) ) engine=innodb default charset=utf8;
i have added dummy entries table during testing. have deleted these entries , want reset auto_inc value should be.
surely don't have remove key before beingness able reset auto_inc value?
what missing here?
mysql not permit decrease auto_increment value, specified here: http://dev.mysql.com/doc/refman/5.6/en/alter-table.html
you cannot reset counter value less or equal the value in use. both innodb , myisam, if value less or equal maximum value in auto_increment column, value reset current maximum auto_increment column value plus one.
mysql reset auto increment value using truncate table statement:
the truncate table statement removes info of table , reset auto-increment value zero. next illustrates syntax of truncate table statement:
truncate table table_name;
by using truncate table statement, can reset auto-increment value zero. in addition, info in table wiped out should utilize truncate table statement caution.
mysql reset auto increment value using drop table , create table statements:
you can utilize pair of statements drop table , create table reset auto-increment column. truncate table statement, statements removes info , reset auto-increment value zero.
drop table table_name; create table table_name(...);
mysql
No comments:
Post a Comment