1075: Incorrect table definition; there can be only one auto column and it must be defined as a key
MySQLWhat does it mean?
The table definition is invalid because the AUTO_INCREMENT rules were violated: a table can have only one auto-increment column, and that column must be part of a key (PRIMARY KEY or UNIQUE/index).
Why does it happen?
Defining more than one AUTO_INCREMENT column, or leaving the AUTO_INCREMENT column out of every key (index). It occurs during CREATE TABLE or ALTER TABLE.
How to fix it
Keep a single AUTO_INCREMENT column and make it part of a key: CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, ...); To fix an existing table, first add the column to a key: ALTER TABLE t ADD PRIMARY KEY (id); then define AUTO_INCREMENT. If you need more than one auto column, revisit the design; MySQL does not support it.
More from this engine
- 1615Prepared statement needs to be re-prepared
- 1553Cannot drop index needed in a foreign key constraint
- 3948Loading local data is disabled; this must be enabled on both the client and server sides
- 1055Expression not in GROUP BY (only_full_group_by)
- 1267Illegal mix of collations
- 1030Got error N from storage engine
- 1197Multi-statement transaction required more than 'max_binlog_cache_size'