MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length MySQL Chyba 1170 (42000): BLOB / TEXT Sloupec Used v Key Specifikace Bez Klíčové Délka

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: Při vytváření nové tabulky nebo měnit existující tabulky s primárním klíčem, unikátní omezení a indexy, nebo při definování nové index s Alter Tabulka manipulace prohlášení v MySQL databázi, tyto chyby se mohou vyskytnout i zakázat příkaz od dokončení:

ERROR 1170 (42000): BLOB/TEXT column 'field_name' used in key specification without a key length ERROR 1170 (42000): BLOB / TEXT sloupce 'field_name' používané v klíčových specifikace bez délce klíče

The error happens because MySQL can index only the first N chars of a BLOB or TEXT column. K chybě dojde proto, že MySQL je index pouze první N znaků a BLOB nebo TEXT sloupce. 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. Takže chyba hlavně stát, když je pole / sloupce typu TEXT a BLOB nebo ti, kteří patří do textu nebo BLOB druhy, jako jsou TINYBLOB, MEDIUMBLOB, LONGBLOB, TINYTEXT, MEDIUMTEXT, a LONGTEXT že se pokusíte, aby jako primární klíč nebo 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. S plnou BLOB nebo TEXT bez délka hodnoty, MySQL není schopen zaručit jedinečnost sloupci jako je proměnlivé a dynamický rozsah. So, when using BLOB or TEXT types as index, the value of N must be supplied so that MySQL can determine the key length. Takže pokud používáte BLOB nebo TEXT typy jako index, hodnota N, musí být dodán tak, že MySQL může určit délku klíče. However, MySQL doesn't support limit on TEXT or BLOB. Nicméně, MySQL nepodporuje limit TEXT nebo BLOB. TEXT(88) simply won't work. TEXT (88) prostě nebude fungovat.

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. Tato chyba se také pop až při pokusu o konverzi sloupec tabulky z non-TEXT a non-BLOB typ jako VARCHAR a ENUM do textu nebo BLOB typ, s kolonou již byly definovány jako omezení nebo jedinečný index. The Alter Table SQL command will fail. V tabulce Alter SQL příkaz se nezdaří.

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. Řešením tohoto problému je odstranění textu nebo BLOB sloupce z indexu nebo unikátní omezením, nebo nastavit jiné pole jako primární klíč. 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. Pokud nemůžete udělat, a chtějí umístit limit na textu nebo BLOB sloupce, zkuste použít typ VARCHAR a místo limit délky na to. 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. Ve výchozím nastavení VARCHAR je omezena na maximálně 255 znaků a jeho hranice, musí být stanovena implicitně ve třídě ihned po svém prohlášení, tj. VARCHAR (200) bude limit je 200 znaků dlouhé pouze.

Sometimes, even though you don't use TEXT or BLOB related type in your table, the Error 1170 may also appear. Někdy, i když nebudete používat TEXT nebo BLOB související napsat tabulku, Error 1170 mohou také objevit. It happens in situation such as when you specify VARCHAR column as primary key, but wrongly set its length or characters size. To se děje v situaci, jako když zadáte VARCHAR sloupec jako primární klíč, ale špatně nastavit její délku nebo velikost znaků. 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 pouze přijímá až 256 znaků, takže něco jako VARCHAR (512) bude platnost MySQL na auto-převést VARCHAR (512) do SMALLTEXT datový typ, který následně selhat s chybou 1170 o klíčových délka kolony, pokud je použit jako primární klíče nebo jedinečného nebo non-jedinečný index. To solve this problem, specify a figure less than 256 as the size for VARCHAR field. K vyřešení tohoto problému, zadejte číslo menší než 256 jako velikost VARCHAR oblasti.

IMPORTANT : The page is machine translated and provided "as is" without warranty. Upozornění: Stránka je stroje přeloženy a poskytovány "tak jak jsou" bez záruky. Machine translation may be difficult to understand. Strojový překlad může být obtížné pochopit. Please refer to Obraťte se prosím na original English article Anglický originál článku whenever possible. kdykoli je to možné.


9 Responses to “MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length” 9 Reakce na "MySQL Chyba 1170 (42000): BLOB / TEXT Sloupec Used v Key Specifikace Bez délce klíče"

  1. Eli Manobella Eli Manobella
    April 30th, 2009 22:32 30. duben 2009 22:32
    9 9

    Thank you for the post. Děkuji za příspěvek.
    I need a key that is longer then 256. Potřebuji klíč, který je delší, než 256.

    What can I do? Co můžu dělat?

    googling it for the past 3 hours with no luck… googling to za poslední 3 hodiny bez štěstí ...
    (Paco Zarabozo comment did not work for me) (Paco Zarabozo komentář nefunguje mi)

  2. Preaching to the UTF8 converted at hontou ni sou omou? Kázání na UTF8 převeden na hontou ni sou omou?
    December 13th, 2008 22:20 13. prosince 2008 22:20
    8 8

    [...] I ran into some problems, I back-pedalled to square one. [...] Jsem běžel do nějaké problémy, jsem zpět-pedalled na začátku. Thankfully my backup restored the Latin1 database without any [...] Naštěstí mé zálohy obnovil Latin1 databáze bez jakéhokoli [...]

  3. Paco Zarabozo Paco Zarabozo
    October 29th, 2008 10:16 29. října 2008 10:16
    7 7

    Well, here's another solution. No, tady je další řešení. You can actually specify the key length for your index while keeping your field as longtext. Můžete skutečně určit délku klíče pro váš index při udržení své pole jako longtext. This is an example: Toto je příklad:

    create table messages ( vytvořit tabulku zpráv (
    id int(20) not null auto_increment, id int (20) NOT NULL auto_increment,
    message longtext, zprávy longtext,
    index (message(996), id) index (zpráva (996), id)
    ); );

    desc messages; desc zpráv;
    show index from messages; show index ze zpráv;

    996 is the maximium key length mySQL has accepted for me. 996 je maximium klíčové délky mySQL přijala pro mě.

    Cheers, Na zdraví,

    Paco Paco

  4. David David
    October 27th, 2008 19:50 27. říjen 2008 19:50
    6 6

    Thanks a lot! Díky moc!

  5. Marius Vilaia Marius Vilaia
    October 6th, 2008 03:50 6. říjen 2008 03:50
    5 5

    Thank you very much. Mockrát děkuji. I had this problem and you were a life saver! Měl jsem tento problém a jsi zachránce života!

  6. Reza Reza
    March 7th, 2008 04:15 7. března 2008 04:15
    4 4

    Thanks, very good defined Díky, velmi dobře definované

  7. Jamie Slater Jamie Slater
    February 23rd, 2008 03:40 23. února 2008 03:40
    3 3

    Thanks for the post. Díky za příspěvek. Very helpful. Velmi užitečné.

  8. Ben Hardy Ben Hardy
    February 20th, 2008 02:45 20. únor 2008 02:45
    2 2

    Thanks! Díky! Very useful post. Velmi užitečnou funkci.

  9. Felix Felix
    August 30th, 2007 18:33 30. srpen 2007 18:33
    1 1

    Thanks for putting this up. Děkuji za uvedení této nahoru. I didn't get the error and you saved me a lot o frustration. I didn't get the error a vy mě zachránila hodně o frustraci. I'd put you in the 'Goog people' category anytime Já bych vás v 'goog lidé' kategorie kdykoliv ;-)

Leave a Reply Zanech Odpověď

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Můžete použít tyto značky: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. Odebírejte komentáře funkce byla vypnuta. To receive notification of latest comments posted, subscribe to Chcete-li dostávat oznámení o nejnovější komentáře posta, přihlaste se My Digital Life Comments RSS feed My Digital Life Komentáře RSS or nebo register to receive registr pro příjem new comments in daily email digest. nové komentáře v denním email Digest.
Custom Search

New Articles Nové články

Incoming Search Terms for the Article Incoming Vyhledávání Podmínky pro článek

used in key specification without a key length používané ve specifikaci klíče bez délky klíče - -- mysql error 1170 mysql chyba 1170 - -- mysql text key mysql text klíč - -- used in key specification without a key length používané ve specifikaci klíče bez délky klíče - -- #1170 - BLOB/TEXT column used in key specification without a key length # 1170 - BLOB / TEXT sloupce použité v klíčových specifikace bez délce klíče - -- MySQL "used in key specification without a key length" MySQL "použitý v klíčových specifikace bez délce klíče" - -- mysql 1170 mysql 1170 - -- 42000 mysql 42000 mysql - -- ERROR 1170 (42000): BLOB/TEXT column used in key specification ERROR 1170 (42000): BLOB / TEXT sloupce použité v klíčových specifikace - -- ERROR 1170 (42000): BLOB/TEXT column 'type' used in key specification without a key length ERROR 1170 (42000): BLOB / TEXT sloupce 'typ' používané v klíčových specifikace bez délce klíče - -- mysql text primary key mysql text primární klíč - -- " used in key specification without a key length " "Používaných v hlavních specifikace bez délce klíče" - -- #1170 - BLOB/TEXT column used in key specification without a key length # 1170 - BLOB / TEXT sloupce použité v klíčových specifikace bez délce klíče - -- #1170 - BLOB/TEXT column 'title' used in key specification without a key length # 1170 - BLOB / TEXT sloupce 'Název' používané v klíčových specifikace bez délce klíče - -- #1170 - BLOB/TEXT column 'post' used in key specification without a key length # 1170 - BLOB / TEXT sloupce 'post' používané v klíčových specifikace bez délce klíče - -- 1170 used in key specification without a key length 1170 používány v klíčových specifikace bez délce klíče - -- BLOB/TEXT column 'oldprob' used in key specification without a key length BLOB / TEXT sloupce 'oldprob' používané v klíčových specifikace bez délce klíče - -- BLOB/TEXT column used in key specification without a key length BLOB / TEXT sloupce použité v klíčových specifikace bez délce klíče - -- BLOB column 'url' used in key specification without a key length BLOB sloupec 'url' používané v klíčových specifikace bez délce klíče - -- BLOB/TEXT column ' used in key specification without a key length BLOB / TEXT sloupce 'používané v klíčových specifikace bez délce klíče - -- blob text column 'id' used in key specification without a key length kapka text sloupce 'id' používané v klíčových specifikace bez délce klíče - -- blob text column 'name' used in key specification without a key length kapka text sloupce 'name' používané v klíčových specifikace bez délce klíče - -- bolg txt column used jey specification without key length bolg txt sloupce použit jey specifikaci klíče bez délky - -- could not create tableBLOB/TEXT column 'ip' used in key specification without a key length Nelze vytvořit tableBLOB / TEXT sloupce 'ip' používané v klíčových specifikace bez délce klíče - -- ERROR 1170 (42000): BLOB/TEXT column used in key specification without a key length ERROR 1170 (42000): BLOB / TEXT sloupce použité v klíčových specifikace bez délce klíče - -- ERROR 1170 (42000): BLOB/TEXT column used in key specification without a key length ERROR 1170 (42000): BLOB / TEXT sloupce použité v klíčových specifikace bez délce klíče - -- modx BLOB/TEXT column 'content' used in key specification without a key length modx BLOB / TEXT sloupce 'obsah' používané v klíčových specifikace bez délce klíče - -- mysql text unique key mysql text unikátní klíč - -- mysql used in key specification without a key length mysql používá ve specifikaci klíče bez délky klíče - -- mysql #1170 mysql # 1170 - -- MySQL Error 1170 MySQL Chyba 1170 - -- MySQL Error Nr. Chyba č. MySQL. 1170 1170 - -- sql text key length sql text klíčové délky - -- #1170 mysql # 1170 mysql - -- BLOB/TEXT column 'page_name' used in key specification without a key length BLOB / TEXT sloupce 'page_name' používané v klíčových specifikace bez délce klíče - -- BLOB/TEXT column 'content' used in key specification without a key length BLOB / TEXT sloupce 'obsah' používané v klíčových specifikace bez délce klíče - -- column used in key specification without a key length sloupce použité v klíčových specifikace bez délce klíče - -- mysql text blob limits mysql text kapka limity - -- mysql The used table type doesn't support BLOB/TEXT columns mysql Použitý typ tabulky nepodporuje BLOB / TEXT sloupce - -- The used table type doesn't support BLOB/TEXT columns Použitý typ tabulky nepodporuje BLOB / TEXT sloupce - --