Reason Analysis:
The reason that MySQL cannot create an automatically incremented field is that it adds several sql_mode to the Server SQL Mode in the MySQL5.0.2 version, and that the Sql-mode in the SQL My.ini file adds two of them by default. One is strict_trans_tables, the mode that causes Auto_increament to fail, and this sql_mode is primarily used when a value cannot be inserted into a table, resulting in an error instead of a warning and terminating the session.
Solution:
Remove or comment out Sql_mode. Restart MySQL.
To My.ini in the following:
Copy Code code as follows:
# Set The SQL mode to strict
Sql-mode= "Strict_trans_tables,no_auto_create_user,no_engine_substitution"
To
Copy Code code as follows:
# Set The SQL mode to Strict[separator]
#sql-mode= "Strict_trans_tables,no_auto_create_user,no_engine_substitution"
Sql-mode= "No_auto_create_user,no_engine_substitution"