Home > Database > Mysql Tutorial > body text

MySql修改或者创建索引是的错误提示:ERROR 1170 (42000): BLOB/T_MySQL

WBOY
Release: 2016-06-01 13:30:35
Original
2199 people have browsed it

bitsCN.com


MySql修改或者创建索引是的错误提示:ERROR 1170 (42000): BLOB/T...解决

 

在创建或修改mysql索引时出现了这样的错误:

 

ERROR 1170 (42000): BLOB/TEXT column 'col2' used in key specification without a key length

 

看了下该表的数据结构发现col2字段类型是text ,查询了下发现是:

 

MySQL只能将BLOB/TEXT类型字段设置索引为BLOB/TEXT数据的钱N个字符.

索引指定下col2的长度就可以了 :

 

alter table foo add index col_2 (col2(10))
Copy after login

 

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template