MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length MySQL Error 1170 (42000): lāse / TEXT sleja Izmantots Galvenie Specifikācija Bez Key Length

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: Veidojot jaunu tabulu vai pārveidojot esošu tabulu ar primārās atslēgas, unikālu ierobežojumu un indeksu, vai definējot jaunu indeksam Alter tabula manipulācijām paziņojumu MySQL datu bāzi, šādu kļūdu var rasties, aizliedz to komandu pabeigt:

ERROR 1170 (42000): BLOB/TEXT column 'field_name' used in key specification without a key length ERROR 1170 (42000): lāse / TEXT slejā "field_name", kas izmantoti galvenajās specifikācija bez atslēgas garumu

The error happens because MySQL can index only the first N chars of a BLOB or TEXT column. Kļūda notiek, jo MySQL var indekss tikai pirmais N chars no lāse vai teksta slejā. 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. Tātad kļūda galvenokārt notiek tad, ja ir joma / kolonna veida TEXT vai lāse vai tās pieder pie teksta vai lāse veidi, piemēram, TINYBLOB, MEDIUMBLOB, LONGBLOB, TINYTEXT, MEDIUMTEXT, un LONGTEXT, ka jūs mēģināt veikt, kā primārā atslēga vai indekss. 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. Pilnībā lāse vai Teksts bez garuma vērtības, MySQL nevar garantēt unikalitāti slejā, kā tas ir mainīgas un dinamiskas lieluma. So, when using BLOB or TEXT types as index, the value of N must be supplied so that MySQL can determine the key length. Tātad, ja izmanto lāse vai teksta veidu, kā indekss, vērtība N jāsniedz tā, ka MySQL var noteikt atslēgas garumu. However, MySQL doesn't support limit on TEXT or BLOB. Tomēr, MySQL neatbalsta limits TEXT vai piciņa. TEXT(88) simply won't work. TEXT (88) vienkārši nestrādās.

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. Kļūda arī pop kad jūs mēģināt pārveidot tabulas ailes no ārpuskopienas TEXT un ārpuskopienas lāse tips, piemēram, VARCHAR un Enum vērā TEXT vai lāse tipa, ar ailē jau ir definēts kā unikālu ierobežojumus vai indekss. The Alter Table SQL command will fail. Par Alter tabula SQL komanda nebūs.

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. Risinājums šai problēmai ir novērst TEXT vai lāse kolonna no indeksa vai unikālu ierobežojums, vai noteikt citā jomā, kā primāro atslēgu. 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. Ja jūs nevarat to darīt, un vēlas, lai robežu, par tekstu vai lāse kolonna, mēģināt lietot VARCHAR veids un vieta, nepārsniedzot garums par 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. Pēc noklusējuma, VARCHAR ir ierobežots līdz 255 rakstzīmes, un tās robeža ir jānorāda netieši ar iekava uzreiz pēc tā deklarācija, ti, VARCHAR (200) būs ierobežotu līdz 200 rakstzīmes garš only.

Sometimes, even though you don't use TEXT or BLOB related type in your table, the Error 1170 may also appear. Reizēm, pat ja jūs neizmantojat TEXT vai lāse related veida jūsu tabulā, kļūdu 1170 var arī parādīties. It happens in situation such as when you specify VARCHAR column as primary key, but wrongly set its length or characters size. Tas notiek situācijā, kad jūs norādāt VARCHAR kolonna kā primārā atslēga, bet nepareizi noteikt tās garuma vai rakstzīmju lielumu. 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 var tikai pieņem līdz 256 rakstzīmēm, tādēļ kaut ko tādu kā VARCHAR (512) liks MySQL, lai automātiski pārveidot VARCHAR (512) uz SMALLTEXT datatype, kas vēlāk nepilda ar error 1170 par atslēgas garumu, ja kolonna tiek izmantots kā primārais taustiņu vai unikālas vai nav unikāls indekss. To solve this problem, specify a figure less than 256 as the size for VARCHAR field. Lai atrisinātu šo problēmu, norāda skaitlis mazāks par 256, kā izmērs VARCHAR jomā.

IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: Šī lapa ir mašīna tulkoto un ar nosacījumu ", kas ir" bez garantijas. Machine translation may be difficult to understand. Machine translation var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.


9 Responses to “MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length” 9 Atbildes uz "MySQL Error 1170 (42000): lāse / TEXT sleja Izmantots Galvenie Specifikācija Bez atslēgas garumu"

  1. Eli Manobella Eli Manobella
    April 30th, 2009 22:32 Aprīlis 30, 2009 22:32
    9 9

    Thank you for the post. Paldies par ziņojumu.
    I need a key that is longer then 256. Man ir vajadzīga atslēgu, kas ir ilgāks, tad 256.

    What can I do? Ko es varu darīt?

    googling it for the past 3 hours with no luck… googling to pēdējos 3 stundas bez luck ...
    (Paco Zarabozo comment did not work for me) (Paco Zarabozo komentēt nestrādāja man)

  2. Preaching to the UTF8 converted at hontou ni sou omou? Sprediķis uz UTF8 konvertē pēc hontou ni SOU omou?
    December 13th, 2008 22:20 Decembris 13, 2008 22:20
    8 8

    [...] I ran into some problems, I back-pedalled to square one. [...] I ilga vērā dažas problēmas, es back-pedalled uz kvadrātveida vienu. Thankfully my backup restored the Latin1 database without any [...] Thankfully mans backup atjaunoja Latin1 datubāzē bez [...]

  3. Paco Zarabozo Paco Zarabozo
    October 29th, 2008 10:16 Oktobris 29, 2008 10:16
    7 7

    Well, here's another solution. Nu, šeit ir cits risinājums. You can actually specify the key length for your index while keeping your field as longtext. Varat faktiski norāda atslēgas garumu jūsu indekss saglabājot jūsu jomā, kā longtext. This is an example: Šis ir piemērs:

    create table messages ( izveidot tabulu ziņojumus (
    id int(20) not null auto_increment, id int (20) not null auto_increment,
    message longtext, ziņu longtext,
    index (message(996), id) indekss (vēstījums (996), id)
    ); );

    desc messages; desc ziņojumus;
    show index from messages; parādīt indekss no ziņojumus;

    996 is the maximium key length mySQL has accepted for me. 996 ir maximium atslēgas garumu MySQL ir pieņēmis par mani.

    Cheers, Urravas,

    Paco Paco

  4. David David
    October 27th, 2008 19:50 Oktobris 27, 2008 19:50
    6 6

    Thanks a lot! Thanks a lot!

  5. Marius Vilaia Marius Vilaia
    October 6th, 2008 03:50 Oktobris 6, 2008 03:50
    5 5

    Thank you very much. Liels paldies. I had this problem and you were a life saver! Man bija šī problēma, un jums bija dzīvības Saver!

  6. Reza Reza
    March 7th, 2008 04:15 Marts 7, 2008 04:15
    4 4

    Thanks, very good defined Paldies, ļoti labi definēts

  7. Jamie Slater Jamie Slater
    February 23rd, 2008 03:40 Februāris 23, 2008 03:40
    3 3

    Thanks for the post. Thanks for the post. Very helpful. Ļoti noderīga.

  8. Ben Hardy Ben Hardy
    February 20th, 2008 02:45 Februāris 20, 2008 02:45
    2 2

    Thanks! Pateicība! Very useful post. Ļoti noderīgs post.

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

    Thanks for putting this up. Paldies par to, lai izmantotu šo uz augšu. I didn't get the error and you saved me a lot o frustration. I didn't get kļūdas un jūs saglabāti man lot o vilšanās. I'd put you in the 'Goog people' category anytime I'd uzvest jūs ar "GOOG cilvēki" kategorijas jebkurā laikā ;-)

Leave a Reply Atstāj atbildi

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> Jūs varat izmantot šos tagus: <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. Parakstīties uz komentāriem iezīme ir atspējota. To receive notification of latest comments posted, subscribe to Lai saņemtu paziņojumu par jaunāko komentāri norīkots darbā, abonēt My Digital Life Comments RSS feed Mani Digital Life Comments RSS feed or vai register to receive reģistrēties, lai saņemtu new comments in daily email digest. jauni komentāri ikdienas e-pasta sagremot.
Custom Search

New Articles Jauns pants

Incoming Search Terms for the Article Incoming Meklēt Noteikumi par pants

used in key specification without a key length izmanto taustiņu specifikācija bez atslēgas garumu - -- BLOB/TEXT column used in key specification without a key length Lāse / TEXT kolonna izmanto galveno specifikācija bez atslēgas garumu - -- used in key specification without a key length izmanto taustiņu specifikācija bez atslēgas garumu - -- mysql error 1170 mysql error 1170 - -- BLOB/TEXT column used in key specification without a key length Lāse / TEXT kolonna izmanto galveno specifikācija bez atslēgas garumu - -- mysql 1170 mysql 1170 - -- blob text column used in key specification without a key length piciņa teksts slejā izmanto galveno specifikācija bez atslēgas garumu - -- #1170 - BLOB/TEXT column used in key specification without a key length # 1170 - lāse / TEXT kolonna izmanto galveno specifikācija bez atslēgas garumu - -- mysql used in key specification without a key length mysql izmanto galveno specifikācija bez atslēgas garumu - -- mysql #1170 mysql # 1170 - -- "used in key specification without a key length" ", ko izmanto galvenajās specifikācija bez atslēgas garumu" - -- #1170 - BLOB/TEXT column used in key specification without a key length # 1170 - lāse / TEXT kolonna izmanto galveno specifikācija bez atslēgas garumu - -- BLOB/TEXT column used in key specification without a key length Lāse / TEXT kolonna izmanto galveno specifikācija bez atslēgas garumu - -- #1170 - BLOB/TEXT column used in key specification without a key length # 1170 - lāse / TEXT kolonna izmanto galveno specifikācija bez atslēgas garumu - -- BLOB/TEXT column 'name' used in key specification without a key length Lāse / TEXT slejā "Nosaukums", kas izmantoti galvenajās specifikācija bez atslēgas garumu - -- error 1170 mysql error 1170 mysql - -- used in key specification without a key length izmanto taustiņu specifikācija bez atslēgas garumu - -- column used in key specification without a key length kolonna izmanto galveno specifikācija bez atslēgas garumu - -- mysql text key length mysql teksts atslēgas garumu - -- key specification without a key length taustiņu specifikācija bez atslēgas garumu - -- #1170 - BLOB/TEXT column # 1170 - lāse / TEXT sleja - -- mysql text key mysql teksts atslēga - -- The used table type doesn't support BLOB/TEXT columns Izmantotās galda tips neatbalsta lāse / TEXT kolonnas - -- BLOB/TEXT column 'description' used in key specification without a key length Lāse / TEXT slejā "apraksts" izmanto atslēgu specifikācija bez atslēgas garumu - -- used in key specification without a key length mysql izmanto taustiņu specifikācija bez atslēgas garumu mysql - -- "used in key specification without a key length " ", ko izmanto galvenajās specifikācija bez atslēgas garumu" - -- mysql text unique mysql teksts unikāls - -- #1170 - BLOB/TEXT column 'name' used in key specification without a key length # 1170 - lāse / TEXT slejā "Nosaukums", kas izmantoti galvenajās specifikācija bez atslēgas garumu - -- mysql text primary key mysql teksts primārā atslēga - -- ERROR 1170 (42000): BLOB/TEXT column used in key specification without a key length ERROR 1170 (42000): lāse / TEXT kolonna izmanto galveno specifikācija bez atslēgas garumu - -- BLOB/TEXT column 'url' used in key specification without a key length Lāse / TEXT slejā "url", kas izmantoti galvenajās specifikācija bez atslēgas garumu - -- BLOB/TEXT column used in key specification without a key length Lāse / TEXT kolonna izmanto galveno specifikācija bez atslēgas garumu - -- error 1170 (42000) error 1170 (42000) - -- ERROR 1170 (42000): BLOB/TEXT column used in key specification without a key length ERROR 1170 (42000): lāse / TEXT kolonna izmanto galveno specifikācija bez atslēgas garumu - -- #1170 - BLOB/TEXT column 'id' used in key specification without a key length # 1170 - lāse / TEXT slejā "id", kas izmantoti galvenajās specifikācija bez atslēgas garumu - -- mysql unique text mysql unikālu teksts - -- BLOB/TEXT column 'email' used in key specification without a key length Lāse / TEXT ailē "e-pasts", kas izmantoti galvenajās specifikācija bez atslēgas garumu - -- MySQL "used in key specification without a key length" MySQL ", ko izmanto galvenajās specifikācija bez atslēgas garumu" - -- MySQL Error Number 1170 MySQL Error skaits 1170 - -- mysql primary key text mysql primārā atslēga teksts - -- mysql key specification without a key length mysql taustiņu specifikācija bez atslēgas garumu - -- text column used in key specification without a key length teksts slejā izmanto galveno specifikācija bez atslēgas garumu - -- #1170 - BLOB/TEXT column 'Username' used in key specification without a key length # 1170 - lāse / TEXT slejā "Lietotājvārds", kas izmantoti galvenajās specifikācija bez atslēgas garumu - -- mysql text as primary key mysql tekstu kā primārā atslēga - -- error 1170 error 1170 - -- mysql error #1170 mysql error # 1170 - -- BLOB/TEXT column 'ID' used in key specification without a key length Lāse / TEXT slejā "ID", kas izmantoti galvenajās specifikācija bez atslēgas garumu - -- #1170 - BLOB/TEXT column 'name' used in key specification without a key length # 1170 - lāse / TEXT slejā "Nosaukums", kas izmantoti galvenajās specifikācija bez atslēgas garumu - -- BLOB/TEXT column 'Value' used in key specification without a key length Lāse / TEXT ailē "Vērtība", kas izmantoti galvenajās specifikācija bez atslēgas garumu - -- MySQL Error Nr. MySQL Error Nr. 1170 1170 - --