Tables +-----+------+ However, in this case, the next available auto-increment value is 105, not 103 because four auto- increment values are allocated at the time the statement is processed, but only two are used. This result is true whether or not there are concurrently executing “ INSERT -like”  statements (of any type). With  innodb_autoinc_lock_mode  set to 2 (“interleaved” ), the four new rows are: The values of  x  and  y  are unique and larger than any previously generated rows. However, the specific values of  x  and  y  depend on the number of auto-increment values generated by concurrently executing statements. Finally, consider the following statement, issued when the most-recently generated sequence number is 100: With any  innodb_autoinc_lock_mode  setting, this statement generates a duplicate-key error 23000 ( Can’t write; duplicate key in table ) because 101 is allocated for the row  (NULL, ’b’) and insertion of the row  (101, ’c’)  fails. In MySQL 5.7 and earlier, modifying an  AUTO_INCREMENT  column value in the middle of a sequence of  INSERT  statements could lead to “Duplicate entry”  errors. For example, if you performed an UPDATE  operation that changed an  AUTO_INCREMENT  column value to a value larger than the current maximum auto-increment value, subsequent  INSERT  operations that did not specify an unused auto- increment value could encounter “Duplicate entry”  errors. In MySQL 8.0 and later, if you modify an AUTO_INCREMENT  column value to a value larger than the current maximum auto-increment value, the new value is persisted, and subsequent  INSERT  operations allocate auto-increment values starting from the new, larger value. This behavior is demonstrated in the following example. 3039 •Modifying  AUTO_INCREMENT  column values in the middle of a sequence of  INSERT  statements mysql>  SELECT c1, c2 FROM t1 ORDER BY c2; +-----+------+ | c1 | c2 | +-----+------+ | 1 | a | | x  | b | | 5 | c | | y  | d | +-----+------+ mysql>  CREATE TABLE t1 ( ->  c1 INT NOT NULL AUTO_INCREMENT, ->  PRIMARY KEY (c1) -> ) ENGINE = InnoDB; mysql>  INSERT INTO t1 VALUES(0), (0), (3); mysql>  SELECT c1 FROM t1; +----+ | c1 | +----+ | 1 | | 2 | | 3 | +----+ mysql>  UPDATE t1 SET c1 = 4 WHERE c1 = 1; mysql>  SELECT c1 FROM t1; +----+ mysql>  INSERT INTO t1 (c1,c2) VALUES (1,’a’), (NULL,’b’), (101,’c’), (NULL,’d’);