Reputation: 29
I meet some errors when using auto_increment
in MySQL.
code is here:
user_id bigint(20) unsigned not null auto_increment=1000
but when I try
user_id bigint(20) unsigned not null auto_increment
it works. why?
Upvotes: 0
Views: 10828
Reputation: 11
This happens because auto increment is set for the table and not a particular column.
So to start from 1000,
Create a table column with just auto_increment
And then alter the table using
ALTER TABLE your_table_name AUTO_INCREMENT=1000;
Upvotes: 1
Reputation: 2817
This should work:
create table test1 (
id int unsigned not null auto_increment,
primary key (id)
)auto_increment=100;
Upvotes: 2
Reputation: 1
auto increment of mysql is only +1 value.
look at this http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
Upvotes: 0
Reputation: 164733
Are you trying to seed the auto increment number?
If so, the syntax is part of the CREATE|ALTER TABLE
command.
See http://dev.mysql.com/doc/refman/5.5/en/example-auto-increment.html
Upvotes: 1