MySQL auto-increment column inserts 0 values. when migrating a database from MSSQL to MySQL, You need to insert 0 values in the auto-increment column of MySQL based on the requirements of the business logic. This is done in MSSQL: www.2cto.com string SQL; SQL = "set identity_insert dbo. appUsers on "+" insert dbo. appUsers (Id, IsLocked, IsMustChangeLocalPassword, IsAvailable, Name, Sequence, CreatedBy, CreatedTime, UpdatedBy, UpdatedTime) "+" values (0, 1, 0, 0, 0, '[SYSTEM]', 0, 0, GetDate (), 0, GetDate () "+" set identity_insert dbo. appUsers off "+" dbcc checkident ('dbo. appUsers ', RESEED, 0) "; db. data Base. executeSqlCommand (SQL); this is written in the MySQL official document: NO_AUTO_VALUE_ON_ZERO affects handling of AUTO_INCREMENT columns. normally, you generate the next sequence number for the column by inserting either NULL or 0 into it. NO_AUTO_VALUE_ON_ZERO suppresses this behavior for 0 so that only NULL generates the next sequence number. this mode can be useful if 0 has been stored in a table's AUTO_INCREMENT column. (Storing 0 is not a recommended practice, by the way .) for example, if you dump the table with mysqldump and then reload it, MySQL normally generates new sequence numbers whenit encounters the 0 values, resulting in a table with contents different from the one that was dumped. enabling NO_AUTO_VALUE_ON_ZERO before reloading the dump file solves this problem. mysqldump now automatically between des I N its output a statement that enables NO_AUTO_VALUE_ON_ZERO, to avoid this problem. generally, NO_AUTO_VALUE_ON_ZERO will affect the auto-incrementing column. Generally, the method to obtain the next sequence value is to insert 0 or NULL values to the auto-incrementing column. NO_AUTO_VALUE_ON_ZERO will change this default behavior so that only NULL values can be inserted to obtain the next sequence value. This method is useful for inserting 0 values into the auto-incrementing column. (By The Way, 0 values are not recommended for auto-incrementing columns.) For example, if you use mysqldump to back up the data table and restore it, in general, MySQL automatically generates a new sequence value with a value of 0, resulting in an error in data recovery from backup. Enable NO_AUTO_VALUE_ON_ZERO Before restoring data. Mysqldump will now automatically include NO_AUTO_VALUE_ON_ZERO in the output statement to solve this problem. In MySQL, You Need To: SQL = "set session SQL _mode = 'no _ AUTO_VALUE_ON_ZERO '; insert AppUsers (Id, IsLocked, IsMustChangeLocalPassword, IsAvailable, Name, Sequence, CreatedBy, CreatedTime, UpdatedBy, updatedTime) "+" values (0, 1, 0, 0, '[ SYSTEM] ', 0, 0, CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP) "; the problem is resolved.