How `AUTO_INCREMENT` works on MySQL

You have created tables with AUTO_INCREMENT. Something like CREATE TABLE user ( user_id INT(11) NOT NULL AUTO_INCREMENT, ... ) MySQL manages user_id for you automatically. You get user_id 1, 2, 3, 4, ... But how does it work? InnoDB, one of the most common storage engine MySQL uses,…