Specified key was too long; max key length is 1000 bytes

别来无恙 提交于 2019-12-07 17:15:49

问题


importimg Joomla 1.5 database via mySQL dump but it gives error "1071 - Specified key was too long; max key length is 1000 bytes"

the culrpit sql statement is:

    CREATE TABLE  `jos_core_acl_aro` (

 `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
 `section_value` VARCHAR( 240 ) NOT NULL DEFAULT  '0',
 `value` VARCHAR( 240 ) NOT NULL ,
 `order_value` INT( 11 ) NOT NULL DEFAULT  '0',
 `name` VARCHAR( 255 ) NOT NULL ,
 `hidden` INT( 11 ) NOT NULL DEFAULT  '0',
  PRIMARY KEY (  `id` ) ,
  UNIQUE KEY (  `section_value` ,  `value` ) ,
  KEY  `jos_gacl_hidden_aro` (  `hidden` )
  ) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =11;

MySQL said:

   #1071 - Specified key was too long; max key length is 1000 bytes

The source & destination database is UTF8. I still don't know why this error occurs :(


回答1:


mysql stores utf8 encoded chars as 3 bytes

your key

UNIQUE KEY (  `section_value` ,  `value` ) ,

has a size of (240 + 240) * 3 bytes, which is greater then 1000 limit




回答2:


The error can be encountered in the php configuration, the problem is that you don't have activate the mbstring extention, so, mysql can't separate or cut the string, and this can be assumed by a multibyte string, try activate mbstring extention in your php.ini and I hope you resolve the problem.



来源:https://stackoverflow.com/questions/6157823/specified-key-was-too-long-max-key-length-is-1000-bytes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!