首页 > WORK > blob index错误

blob index错误

版权声明:本文可以任意转载,转载时请务必以超链接形式标明文章原始出处作者署名本版权声明

数据库升级为mysql 5.0,重新导入表的时候出现如下错误:

#
# table structure for table 'locales_source'
#
create table /*!32300 if not exists*/locales_source(
lid int( 11 ) not null auto_increment ,
location varchar( 255 ) not null default '',
source blob not null default '',
primary key ( lid ) ,
index source( source )
);

MySQL answer : #1170 – BLOB/TEXT column ’source’ used in key specification without a key length

在mysql官方网站上找到了解决办法:http://forums.mysql.com/read.php?10,113556,113556#msg-113556

mysql 5.0以后text/blob index需要指定长度,改为下面的写法就通过了,

#
# table structure for table 'locales_source'
#
create table /*!32300 if not exists*/locales_source(
lid int( 11 ) not null auto_increment ,
location varchar( 255 ) not null default '',
source blob not null default '',
primary key ( lid ) ,
index source( source( 30 ) )
);

分类: WORK 标签:
  1. 本文目前尚无任何评论.