Troubleshooting of MySQL errors: Difference between revisions
Jump to navigation
Jump to search
查詢發生錯誤 (1170): BLOB/TEXT column 'url' used in key specification without a key length
(查詢發生錯誤 (1170): BLOB/TEXT column 'url' used in key specification without a key length) |
|||
| Line 235: | Line 235: | ||
Possible solution | Possible solution | ||
* Because the hard disk of partition where [https://dev.mysql.com/doc/refman/5.7/en/data-directory.html MySQL Data Directory] located is full or almost full, free some hard disk space<ref>[http://stackoverflow.com/questions/730579/error-1114-hy000-the-table-is-full mysql - ERROR 1114 (HY000): The table is full - Stack Overflow]</ref>. | * Because the hard disk of partition where [https://dev.mysql.com/doc/refman/5.7/en/data-directory.html MySQL Data Directory] located is full or almost full, free some hard disk space<ref>[http://stackoverflow.com/questions/730579/error-1114-hy000-the-table-is-full mysql - ERROR 1114 (HY000): The table is full - Stack Overflow]</ref>. | ||
== ERROR 1170: BLOB/TEXT column 'url' used in key specification without a key length == | |||
Condition | |||
* SQL syntax when tried to create the new table | |||
<pre> | |||
DROP TABLE IF EXISTS `my_table`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!40101 SET character_set_client = utf8 */; | |||
CREATE TABLE `my_table` ( | |||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |||
`title` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||
`url` text COLLATE utf8mb4_unicode_ci NOT NULL, | |||
`status` tinyint(2) unsigned NOT NULL DEFAULT 1, | |||
PRIMARY KEY (`job_id`), | |||
UNIQUE KEY `url` (`url`) USING HASH | |||
) ENGINE=InnoDB AUTO_INCREMENT=3573 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
</pre> | |||
Solution: BLOB/TEXT column 'url' used in key specification with a key length e.g. {{kbd | key=`url`(500)}} | |||
<pre> | |||
DROP TABLE IF EXISTS `my_table`; | |||
/*!40101 SET @saved_cs_client = @@character_set_client */; | |||
/*!40101 SET character_set_client = utf8 */; | |||
CREATE TABLE `my_table` ( | |||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |||
`title` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||
`url` text COLLATE utf8mb4_unicode_ci NOT NULL, | |||
`status` tinyint(2) unsigned NOT NULL DEFAULT 1, | |||
PRIMARY KEY (`id`), | |||
UNIQUE KEY `url` (`url`(500)) | |||
) ENGINE=InnoDB AUTO_INCREMENT=3573 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
/*!40101 SET character_set_client = @saved_cs_client */; | |||
</pre> | |||
== ERROR 1205: Lock wait timeout exceeded; try restarting transaction == | == ERROR 1205: Lock wait timeout exceeded; try restarting transaction == | ||