Error
Error Code:
4109
MySQL Error 4109: Invisible Primary Key Conflict
Description
This error indicates that MySQL attempted to automatically generate an invisible primary key for an InnoDB table, but the table already contains an AUTO_INCREMENT column. MySQL tables can only have one AUTO_INCREMENT column, leading to this conflict when the `sql_generate_invisible_primary_key` setting is active.
Error Message
Failed to generate invisible primary key. Auto-increment column already exists.
Known Causes
3 known causesEnabled Invisible PK Generation
The `sql_generate_invisible_primary_key` system variable is enabled, prompting MySQL to create an invisible primary key for tables without an explicit one.
Table Has Auto-Increment Column
The target InnoDB table already defines an `AUTO_INCREMENT` column, which conflicts with the attempt to generate an invisible primary key.
Implicit PK Generation Attempt
An operation (e.g., `CREATE TABLE` without an explicit primary key) implicitly triggers the generation of an invisible primary key while an `AUTO_INCREMENT` column already exists.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service