テーブルがすでに存在する場合:
ALTER TABLE your_table AUTO_INCREMENT = 6000;
テーブルを最初から作成する場合:
CREATE TABLE your_table () AUTO_INCREMENT = 6000;
ソースと詳細情報:
テストケース:
CREATE TABLE users (
user_id int NOT NULL,
name varchar(50),
PRIMARY KEY (user_id)
);
INSERT INTO users VALUES (1, 'Bob');
INSERT INTO users VALUES (2, 'Joe');
INSERT INTO users VALUES (3, 'Paul');
ALTER TABLE users MODIFY user_id int NOT NULL AUTO_INCREMENT;
ALTER TABLE users AUTO_INCREMENT = 6000;
INSERT INTO users (name) VALUES ('Keith');
INSERT INTO users (name) VALUES ('Steve');
INSERT INTO users (name) VALUES ('Jack');
SELECT * FROM users;
+---------+-------+
| user_id | name |
+---------+-------+
| 1 | Bob |
| 2 | Joe |
| 3 | Paul |
| 6000 | Keith |
| 6001 | Steve |
| 6002 | Jack |
+---------+-------+
6 rows in set (0.01 sec)