MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length MySQL-Fehler 1170 (42000): BLOB / TEXT-Spalte Used in Key Spezifikation ohne Schlüssel Länge
When creating a new table or altering an existing table with primary keys, unique constraints and indexes, or when defining a new index with Alter Table manipulation statement in MySQL database, the following error may occur and prohibit the the command from completing: Beim Anlegen einer neuen Tabelle oder Änderung einer bestehenden Tabelle mit Primärschlüssel, einzigartigen Zwänge und Indizes, oder bei der Definition einer neuen Index mit ALTER TABLE-Manipulation-Anweisung in MySQL-Datenbank, die folgende Fehlermeldung kann auftreten, und das Verbot der Befehl ausgeführt:
ERROR 1170 (42000): BLOB/TEXT column ‘field_name’ used in key specification without a key length ERROR 1170 (42000): BLOB / TEXT-Spalte 'field_name "in key specification ohne Schlüssel Länge
The error happens because MySQL can index only the first N chars of a BLOB or TEXT column. Der Fehler tritt auf, weil MySQL-Index kann nur die ersten n Zeichen eines BLOB-oder TEXT-Spalte. So The error mainly happen when there is a field/column type of TEXT or BLOB or those belongs to TEXT or BLOB types such as TINYBLOB, MEDIUMBLOB, LONGBLOB, TINYTEXT, MEDIUMTEXT, and LONGTEXT that you try to make as primary key or index. So dass der Fehler passieren, vor allem, wenn es ein Feld / Spalte Art von Text-oder BLOB-oder solche, gehört zum TEXT oder BLOB-Typen wie TINYBLOB, MEDIUMBLOB, LONGBLOB, TINYTEXT, MEDIUMTEXT und LONGTEXT, dass Sie versuchen, als Primärschlüssel oder Index. With full BLOB or TEXT without the length value, MySQL is unable to guarantee the uniqueness of the column as it’s of variable and dynamic size. Mit voller BLOB-oder Text ohne die Länge Wert, MySQL ist nicht in der Lage zu garantieren, die Einzigartigkeit der Spalte als es ist variabel und dynamische Größe. So, when using BLOB or TEXT types as index, the value of N must be supplied so that MySQL can determine the key length. Also, wenn Sie BLOB-oder TEXT-Typen als Inhalt, den Wert von N so müssen diese so dass MySQL kann bestimmen, die Schlüssellänge. However, MySQL doesn’t support limit on TEXT or BLOB. Allerdings, MySQL unterstützt keine Begrenzung auf TEXT oder BLOB. TEXT(88) simply won’t work. TEXT (88) nicht mehr funktionieren wird.
The error will also pop up when you try to convert a table column from non-TEXT and non-BLOB type such as VARCHAR and ENUM into TEXT or BLOB type, with the column already been defined as unique constraints or index. Der Fehler wird auch Pop-up, wenn Sie versuchen, eine Tabellenspalte aus Nicht-TEXT und BLOB-nicht-Typ wie VARCHAR und ENUM in TEXT oder BLOB-Typ, mit dem Spalte bereits als eindeutig Zwänge oder Index. The Alter Table SQL command will fail. Die ALTER TABLE-SQL-Befehl wird fehlschlagen.
The solution to the problem is to remove the TEXT or BLOB column from the index or unique constraint, or set another field as primary key. Die Lösung des Problems besteht darin, den Text oder BLOB-Spalte aus dem Index oder eine eindeutige Einschränkung, oder ein anderes Feld als Primärschlüssel. If you can’t do that, and wanting to place a limit on the TEXT or BLOB column, try to use VARCHAR type and place a limit of length on it. Wenn Sie nicht tun, und wollen eine Begrenzung auf den Text oder BLOB-Spalte, versuche es mal mit VARCHAR Art und Ort einer Obergrenze von Dauer ist. By default, VARCHAR is limited to a maximum of 255 characters and its limit must be specified implicitly within a bracket right after its declaration, ie VARCHAR(200) will limit it to 200 characters long only. Standardmäßig VARCHAR ist auf maximal 255 Zeichen und ihre Grenze muss angegeben werden implizit in eine Halterung rechts nach seiner Erklärung, dh VARCHAR (200) wird sie auf 200 Zeichen lang sein.
Sometimes, even though you don’t use TEXT or BLOB related type in your table, the Error 1170 may also appear. Manchmal, auch wenn Sie nicht verwenden TEXT oder BLOB-verwandte Art in Ihrer Tabelle, die Fehler können auch 1170 erscheinen. It happens in situation such as when you specify VARCHAR column as primary key, but wrongly set its length or characters size. Es geschieht in Situation, wie wenn Sie VARCHAR-Spalte als Primärschlüssel, aber falsch eingestellte ihrer Länge oder Zeichen Größe. VARCHAR can only accepts up to 256 characters, so anything such as VARCHAR(512) will force MySQL to auto-convert the VARCHAR(512) to a SMALLTEXT datatype, which subsequently fail with error 1170 on key length if the column is used as primary key or unique or non-unique index. VARCHAR kann nur akzeptiert bis zu 256 Zeichen, so etwas wie VARCHAR (512) zwingen wird MySQL zu auto-convert die VARCHAR (512) zu einem SMALLTEXT Datentyp, der später nicht mit Fehler 1170 auf Schlüssellänge, wenn die Spalte wird als primäre Schlüssel oder einen eindeutigen oder nicht eindeutigen Index. To solve this problem, specify a figure less than 256 as the size for VARCHAR field. Um dieses Problem zu lösen, geben Sie eine Zahl von weniger als 256, wie die Größe für VARCHAR-Feld.
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. WICHTIG: Es handelt sich um eine Maschine der Seite übersetzt wird "as is" ohne Garantie. Machine translation may be difficult to understand. Maschinelle Übersetzung ist vielleicht schwierig zu verstehen. Please refer to Bitte wenden Sie sich an original English article Original Englisch Artikel whenever possible. wann immer dies möglich ist.
Share and contribute or get technical support and help at Aktie und einen Beitrag oder erhalten technische Unterstützung und Hilfe an My Digital Life Forums Meine digitalen Lebens Foren .
Related Articles Verwandte Artikel
- How to Convert Character Set and Collation of WordPress Database How to convert character set und Zusammenstellung von WordPress-Datenbank
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 3 Installation von Web-Server in FreeBSD 6,0 mit Apache 2,2, 5,0 MySQL und PHP 5 - Teil 3
- Create New Table by Selecting Data from Other Tables with CREATE TABLE AS Erstellen Sie eine neue Tabelle, indem Sie Daten aus anderen Tabellen mit CREATE TABLE als
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 Installation von Web-Server in Windows XP mit Apache2, PHP5 und MySQL4 - Teil 4
- Change and Reset MySQL root Password Ändern und Reset MySQL Root-Passwort
- ORA-02449 Oracle Drop Table Error ORA-02449 Oracle DROP TABLE-Fehler
- Enable MySQL InnoDB Storage Engine Support in XAMPP Installation Aktivieren Sie MySQL-Storage-Engine InnoDB-Unterstützung bei der XAMPP-Installation
- WordPress MySQL SQL Query Error in WPDB Class WordPress MySQL-SQL-Abfrage Fehler in WPDB Klasse
- Easily Duplicate, Copy or Backup Tables in Oracle, PostgreSQL, DB2 and SQLite with Create Table As SQL Leicht zu duplizieren, kopieren oder Backup-Tabellen in Oracle, PostgreSQL, DB2 und SQLite mit Create Table Wie SQL -
- Oracle PL/SQL ORA-00947 Not Enough Values Error Oracle PL / SQL-ORA-00947 nicht genug Werte Fehler

































August 30th, 2007 18:33 30. August 2007 18:33
Thanks for putting this up. Vielen Dank für das Inverkehrbringen dieses. I didn’t get the error and you saved me a lot o frustration. Ich habe nicht den Fehler und man hat mich gerettet o viel Frustration. I’d put you in the ‘Goog people’ category anytime Ich würde Sie in der "GOOG Menschen kategorie jederzeit
February 20th, 2008 02:45 20. Februar 2008 02:45
Thanks! Danke! Very useful post. Sehr nützlich Post.
February 23rd, 2008 03:40 23. Februar 2008 03:40
Thanks for the post. Vielen Dank für die Post. Very helpful. Sehr hilfreich.
March 7th, 2008 04:15 7. März, 2008 04:15
Thanks, very good defined Danke, sehr gut definiert