1075: Incorrect table definition; there can be only one auto column and it must be defined as a key
MySQLWas bedeutet das?
Die Tabellendefinition ist ungültig, weil die AUTO_INCREMENT-Regeln verletzt wurden: Eine Tabelle kann nur eine Auto-Increment-Spalte haben, und diese muss Teil eines Schlüssels sein (PRIMARY KEY oder UNIQUE/Index).
Ursache
Definition mehrerer AUTO_INCREMENT-Spalten oder eine AUTO_INCREMENT-Spalte, die in keinem Schlüssel (Index) enthalten ist. Tritt bei CREATE TABLE oder ALTER TABLE auf.
Lösung
Behalte eine einzige AUTO_INCREMENT-Spalte und mache sie zum Teil eines Schlüssels: CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, ...); Um eine vorhandene Tabelle zu korrigieren, nimm die Spalte zuerst in einen Schlüssel auf: ALTER TABLE t ADD PRIMARY KEY (id); und definiere dann AUTO_INCREMENT. Brauchst du mehr als eine Auto-Spalte, überdenke das Design; MySQL unterstützt das nicht.
Weitere Einträge zu dieser Datenbank
- 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'