MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length MySQLÀÇ ¿À·ù 1170 (42000) : ¶§´Â / ÅØ½ºÆ® ¿­¿¡ ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ëÇÒ

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: »õ Å×À̺íÀ» ¸¸µé ¶§ ¶Ç´Â ±âº» Ű, °íÀ¯ Á¦¾à ¹× »öÀÎ »ý¼ºÇϰųª, MySQL µ¥ÀÌÅͺ£À̽º¿¡¼­ º¯°æµÇ¸é »õ »öÀΠǥ Á¶ÀÛ ¼º¸í°ú Á¤ÀÇ¿Í ±âÁ¸ Å×À̺íÀ» º¯°æ, ´ÙÀ½°ú °°Àº ¿À·ù°¡ ¹ß»ýÇÒ ¼ö ÀÖÀ¸¸ç ¿Ï·áÀ¸·ÎºÎÅÍ ±ÝÁö ¸í·É :

ERROR 1170 (42000): BLOB/TEXT column ¡®field_name¡¯ used in key specification without a key length ¿À·ù 1170 (42000) : ¶§´Â / ÅØ½ºÆ® ¿­ÀÇ 'field_name'۸¦ »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë

The error happens because MySQL can index only the first N chars of a BLOB or TEXT column. ¿À·ù°¡ ¹ß»ýÇϱ⠶§¹®¿¡ BLOB¸¦ ¶Ç´Â ÅØ½ºÆ® ¿­À»ÀÇ »öÀÎÀ» »ý¼ºÇÒ ¼ö MySQLÀº ¸ÕÀú N¿¡¸¸ ¹®ÀÚ. 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. ±×·¡¼­ ÀÏÀÌÀÖÀ» ¶§ÀÌ ¿À·ù´Â ÁÖ·Î ÇʵåÀÔ´Ï´Ù / ÅØ½ºÆ® ¶Ç´Â BLOBÀÇ Ä®·³µéÀ» ÀÔ·ÂÇϰųª ÅØ½ºÆ® ¶Ç´Â TINYBLOB, MEDIUMBLOB, LONGBLOB, TINYTEXT, MEDIUMTEXT °°Àº BLOB À¯Çü¿¡ ¼ÓÇÏ´Â LONGTEXT ±× ±âº» Ű ¶Ç´Â À妽º·Î ¸¸µé·Á°íÇß´Ù. 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. ÀüüÀÇ BLOB ¶Ç´Â ÅØ½ºÆ® ±æÀÌ °ªÀ» ¾Ê°í, MySQLÀÌ Ä®·³ÀÇ °íÀ¯¼ºÀ» º¸ÀåÇÒ ¼ö¾ø´Â¸¸Å­ º¯¼ö¿Í µ¿Àû Å©±âÀÇ. So, when using BLOB or TEXT types as index, the value of N must be supplied so that MySQL can determine the key length. ±×·¡¼­, ÅØ½ºÆ® ¶Ç´Â À妽º À¯Çü¿¡ BLOB¸¦ »ç¿ëÇÏ¿©, NÀÌ °ªÀ» MySQLÀº Ű ±æÀ̸¦ °áÁ¤ÇÒ ¼ö ÀÖµµ·Ï Áö¿øÇؾßÇÕ´Ï´Ù. However, MySQL doesn¡¯t support limit on TEXT or BLOB. ±×·¯³ª MySQLÀº ÅØ½ºÆ® ¶Ç´Â Blob¿¡ Á¦ÇÑÀ» Áö¿øÇÏÁö ¾Ê½À´Ï´Ù. TEXT(88) simply won¡¯t work. ÅØ½ºÆ® (88)´Â ´Ü¼øÈ÷ ÀÛµ¿ÇÏÁö ¾Ê½À´Ï´Ù.

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. ¿À·ùµµ ¶§ ¾Æ´Ñ Å×À̺íÀÇ BLOB ¿­¿¡ - ÅØ½ºÆ® ¹× ºñ - ÅØ½ºÆ® ¶Ç´Â À¯Çü¿¡ VARCHAR¿Í °°Àº BLOB ¿­°Å ŸÀÔ, Ä÷³Àº ÀÌ¹Ì µ¶Æ¯ÇÑ Á¦¾à Á¶°Ç ¶Ç´Â À妽º·Î Á¤ÀÇ¿Í º¯È¯ÇÏ·Á°í ÆË¾÷µË´Ï´Ù. The Alter Table SQL command will fail. ÀÌ ¾ËÅÍ Ç¥ SQL ¸í·ÉÀÌ ½ÇÆÐÇϰԵ˴ϴÙ.

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. ÀÌ ¹®Á¦¸¦ ÇØ°áÇÏ·Á¸é »öÀÎ ¶Ç´Â UNIQUE Á¦¾à¿¡¼­ ÅØ½ºÆ® ¶Ç´Â BLOB ¿­À» Á¦°ÅÇÏ´Â °ÍÀÔ´Ï´Ù ¶Ç´Â ±âº» Ű·Î ´Ù¸¥ Çʵ带 ¼³Á¤ÇÕ´Ï´Ù. 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. ¸¸¾à ³×°¡ ±×·¸°ÔÇÑ´Ù¸é, ±×¸®°í ÅØ½ºÆ® ¶Ç´Â BLOB ¿­À»¿¡ ÇѰ谡 ÀÚ¸®ÇÏ°í ½ÍÀº, ÇÒ ¼ö ¾ø¾î VARCHAR À¯ÇüÀ» »ç¿ëÇÏ·Á°íÇÏ°í ±×°Í¿¡ ±æÀÌÀÇ ÇѰè Àå¼Ò. 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. ±âº»ÀûÀ¸·Î, ÀÚ»çÀÇ ÇѰ踦 ¾Ï½Ã a ºê¶óÄÏ VARCHAR ¿À¸¥ÂÊ À̳» ¼±¾ð, Áï VARCHAR (200) 200 ¹®ÀÚ ±æÀÌ Á¦ÇÑÀ» ÁöÁ¤ÇؾßÇÕ´Ï´Ù¿¡¸¸ 255 ÀÚ¿ÍÀÇ ÃÖ´ë·Î Á¦Çѵ˴ϴÙ.

Sometimes, even though you don¡¯t use TEXT or BLOB related type in your table, the Error 1170 may also appear. °¡²ûÀº, ºñ·Ï ÅØ½ºÆ®¸¦ ÀÔ·ÂÇϰųª °ü·Ã Å×ÀÌºí¿¡ BLOB¸¦ »ç¿ëÇÏÁö ¾ÊÀ¸¸é ¿À·ù 1170µµ ³ªÅ¸³¯ ¼öÀÖ½À´Ï´Ù. It happens in situation such as when you specify VARCHAR column as primary key, but wrongly set its length or characters size. ±×°ÍÀº ±×·¯ÇÑ »óȲ¿¡¼­ ¿­À» ÁöÁ¤ÇÏ¸é ±âº» Ű·Î VARCHAR ¾Æ´Ï¶ó, ÀÏÀÌ À߸øÀº ±æÀÌ ¶Ç´Â ¹®ÀÚ Å©±â¸¦ ¼³Á¤ÇÕ´Ï´Ù. 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 ¼öÀÖ´Â 256 ÀÚ)·Î ÀÚµ¿ º¯È¯ VARCHAR MySQLÀ» °­¿äÇÏ°Ô µÉ - ±×·¡¼­ ¾Æ¹«°Íµµ °°Àº VARCHAR (512 ÃÖ´ë ¼ö¿ë (512) Ä®·³À» ±âº»À¸·Î »ç¿ëµÇ´Â °æ¿ì´Â ÀÌÈÄ¿¡ Ű ±æÀÌ¿¡ ¿À·ù 1170¿Í ÇÔ²² ½ÇÆÐ SMALLTEXTÀº datatype, Ű ¶Ç´Â °íÀ¯ ¾Æ´Ï¸é non - °íÀ¯ À妽º. To solve this problem, specify a figure less than 256 as the size for VARCHAR field. ÀÌ ¹®Á¦¸¦ ÇØ°áÇÏ·Á¸é, VARCHAR ÇʵåÀÇ Å©±â·Î ¼öÄ¡ 256 ¹Ì¸¸À» ÁöÁ¤ÇÒ ¼öÀÖ½À´Ï´Ù.

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. Áß¿ä :ÀÌ ±â°è´Â "º¸Áõµµ¾øÀÌÀÖ´Â ±×´ë·Î"Á¦°øµË´Ï´Ù ÆäÀÌÁö¸¦ ¹ø¿ªÇß´Ù. Machine translation may be difficult to understand. ±â°è ¹ø¿ªÀ» ÀÌÇØÇϱ⠾î·Á¿ï ¼öÀÖ½À´Ï´Ù. Please refer to À» ÂüÁ¶ÇϽñ⠹ٶø´Ï´Ù original English article ¿ø·¡ ¿µ¾î ¹®¼­ whenever possible. ¾ðÁ¦µç °¡´ÉÇÕ´Ï´Ù.

Share and contribute or get technical support and help at °øÀ¯¿Í ±â¿©Çϰųª ±â¼ú Áö¿ø°ú¿¡ µµ¿òÀÌ My Digital Life Forums ³» µðÁöÅÐ »ýȰ Æ÷·³ .



5 Responses to ¡°MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length¡± 5 ´äº¯Àº "MySQLÀÇ ¿À·ù 1170 (42000) : ¶§´Â / ÅØ½ºÆ® ¿­¿¡ ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë"

  1. Felix Æç¸¯½º
    August 30th, 2007 18:33 8 ¿ù 30 ÀÏ 2007 18:33
    1

    Thanks for putting this up. ÆÛÆÃÀÌ ÃÖ´ë Áּż­ °¨»çÇÕ´Ï´Ù. I didn¡¯t get the error and you saved me a lot o frustration. ³ª´Â ¿À·ù°¡ ¹ß»ýÇÏÁö ¾Ê¾Ò°í ´ç½ÅÀº ³»°Ô ¸¹Àº O¸¦ ÁÂÀý°¨À» ±¸Çß¾î¿ä. I¡¯d put you in the ¡®Goog people¡¯ category anytime ³»°¡ 'GOOG¿¡ »ç¶÷µéÀº'Ä«Å×°í¸®¿¡ ¾ðÁ¦µçÁö ó³Ö¾ú¾î ;-)

  2. Ben Hardy º¥ Çϵð
    February 20th, 2008 02:45 2 ¿ù 20 ÀÏ 2008 2½Ã 45ºÐ
    2

    Thanks! °¨»çÇÕ´Ï´Ù! Very useful post. ¸Å¿ì À¯¿ëÇÑ °Ô½ÃÇÒ ¼öÀÖ½À´Ï´Ù.

  3. Jamie Slater Á¦ÀÌ¹Ì ½½·¹ÀÌÅÍ
    February 23rd, 2008 03:40 2008³â 2¿ù 23ÀÏ 03:40
    3

    Thanks for the post. °Ô½Ã¹°À» Áּż­ °¨»çÇÕ´Ï´Ù. Very helpful. ¸Å¿ì µµ¿òÀÌ.

  4. Reza ·¹ÀÚ
    March 7th, 2008 04:15 2008³â 3¿ù 7ÀÏ 4½Ã 15ºÐ
    4

    Thanks, very good defined °í¸¶¿ö, ¸Å¿ì Àß Á¤ÀǵÈ

  5. Marius Vilaia ¸¶¸®¿ì½º Vilaia
    October 6th, 2008 03:50 2008³â 10¿ù 6ÀÏ 03:50
    5

    Thank you very much. Áø½ÉÀ¸·Î °¨»çÇÕ´Ï´Ù. I had this problem and you were a life saver! Àú´ÂÀÌ ¹®Á¦¸¦Çß°í ´ç½ÅÀº »ý¸íÀÇ ÀºÀÎ!

Leave a Reply ȸ½ÅÀ» ³²°ÜÁÖ¼¼¿ä

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> ÀÌ·¯ÇÑ ÅÂ±× : title="">Àº <a href="" »ç¿ëÇÒ ¼öÀÖ½À´Ï´Ù <abbr title=""> <acronym title="">ÀÇ <b> <blockquote cite=""> <cite>ÀÇ <code> <¹ã ³¯Â¥ = "">Àº <em>°¡ <i> <q cite=""> <strike>ÀÇ <strong>

Subscribe without commenting ÄÚ¸àÆ®¸¦ ±¸µ¶ÇÏÁö ¾Ê°í


Custom Search

New Articles »õ ¹®¼­

Incoming Search Terms for the Article ¿¡ ´ëÇÑ °Ë»ö ¾à°ü¹Þ´Â Á¦

BLOB/TEXT column used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - used in key specification without a key length ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - "used in key specification without a key length" "Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ"»ç¿ë - - used in key specification without a key length ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - mysql error 1170 MySQLÀÇ ¿À·ù 1170 - - BLOB/TEXT column used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - #1170 - BLOB/TEXT column used in key specification without a key length # 1170 - BLOB¸¦ / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - #1170 - BLOB/TEXT column # 1170 - BLOB¸¦ / ÅØ½ºÆ® Ä®·³ - - BLOB/TEXT column used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - mysql #1170 MySQLÀº # 1170 - - ERROR 1170 (42000) ¿À·ù 1170 (42000) - - BLOB/TEXT column used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - #1170 - BLOB/TEXT column used in key specification without a key length # 1170 - BLOB¸¦ / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - mysql used in key specification without a key length MySQLÀÇ ÁÖ¿ä »ç¾ç¿¡¼­ »ç¿ëÇϴ Ű ±æÀ̾øÀÌ - - key specification without a key length Ű ±æÀ̾øÀÌ ÁÖ¿ä »ç¾ç - - The used table type doesn't support BLOB/TEXT columns »ç¿ëµÈ Å×À̺í Çü½ÄÀÇ BLOB / ÅØ½ºÆ® ¿­À» Áö¿øÇÏÁö ¾Ê½À´Ï´Ù - - error 1170 mysql ¿À·ù 1170¿¡ mysql - - blob text column used in key specification without a key length ÁÖ¿ä »ç¾ç¿¡ ¹«´Ì ÅØ½ºÆ® Ä®·³ Ű ±æÀ̾øÀÌ »ç¿ë - - mysql error number 1170 MySQLÀÇ ¿À·ù ¹øÈ£ 1170 - - #1170 - BLOB/TEXT column 'id' used in key specification without a key length # 1170 - BLOB¸¦ / ÅØ½ºÆ® ¿­ÀÇ 'id°¡'ÇÙ½É »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - used in key specification without a key length mysql ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀÌ mysqlÀ»ÇÏÁö ¾Ê°íµµ »ç¿ë - - 1170 mysql MySQLÀº 1170 - - mysql 1170 MySQLÀº 1170 - - BLOB/TEXT column 'Name' used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® ¿­ÀÇ 'À̸§'ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - BLOB/TEXT column 'jid' used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® ¿­ÀÇ 'jid'۸¦ »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - #1170 - BLOB/TEXT column 'uri' used in key specification without a key length # 1170 - BLOB¸¦ / ÅØ½ºÆ® ¿­ÀÇ 'URI¸¦'Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - BLOB/TEXT column 'name' used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® ¿­ÀÇ 'À̸§'ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - in key specification without a key length ÁÖ¿ä »ç¾ç Ű ±æÀ̾øÀÌ - - ERROR 1170 (42000): BLOB/TEXT column used in key specification without a key length ¿À·ù 1170 (42000) : ¶§´Â / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - ERROR 1170 (42000) at line 57: BLOB/TEXT column 'jid' used in key specification without a key length ¿À·ù 1170 (42000) ¶óÀÎ 57 : BLOB¸¦ / ÅØ½ºÆ® ¿­ÀÇ 'jid'۸¦ »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - The used table type doesn't support BLOB/TEXT columns »ç¿ëµÈ Å×À̺í Çü½ÄÀÇ BLOB / ÅØ½ºÆ® ¿­À» Áö¿øÇÏÁö ¾Ê½À´Ï´Ù - - mysql text key MySQLÀÇ ¹®ÀÚ Å° - - BLOB/TEXT column 'id' used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® ¿­ÀÇ 'id°¡'ÇÙ½É »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - column used in key specification without a key length Ä®·³ ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - column used in key specification without a key length Ä®·³ ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - Mysql::Error: BLOB/TEXT column used in key specification without a key length MySQLÀº : : ¿À·ù : BLOB¸¦ / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - mysql text unique MySQLÀÇ µ¶Æ¯ÇÑ ÅØ½ºÆ® - - blob/text column used in key specification without a key length ¹«´Ì / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - BLOB/TEXT used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - mysql text used in key specification without a key length Ű ±æÀ̾øÀÌ MySQLÀÇ ÁÖ¿ä »ç¾ç¿¡¼­ »ç¿ëµÇ´Â ÅØ½ºÆ® - - mysql BLOB/TEXT column used in key specification without a key length MySQLÀº BLOB¸¦ / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - #1170 - BLOB/TEXT column 'supplement' used in key specification without a key length # 1170 - BLOB¸¦ / ÅØ½ºÆ® Ä®·³À» 'º¸Ãæ'۸¦ »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - BLOB/TEXT column 'username' used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® ¿­ÀÇ '»ç¿ëÀÚ'ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - mysql "key specification without a key length" Ű ±æÀ̾øÀÌ "MySQLÀÇ ÁÖ¿ä »ç¾ç" - - 1170 blob/text 1170 ¹«´Ì / ÅØ½ºÆ® - - BLOB/TEXT column 'query' used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® ¿­ÀÇ '°Ë»ö¾î'¸¦ ÁÖ¿ä »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - ERROR 1170 (42000): BLOB/TEXT column used in key specification without a key length ¿À·ù 1170 (42000) : ¶§´Â / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - mysql error 42000 MySQLÀÇ ¿À·ù 42000 - - #1170 - BLOB/TEXT column used in key specification without a key length # 1170 - BLOB¸¦ / ÅØ½ºÆ® Ä®·³ Ű »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - - BLOB/TEXT column 'jid' used in key specification without a key length ¿¡ BLOB / ÅØ½ºÆ® ¿­ÀÇ 'jid'۸¦ »ç¾ç¿¡ Ű ±æÀ̾øÀÌ »ç¿ë - -