Page 1 of 1

1071 error to do with keys - sql import

Posted: Wed Feb 28, 2007 3:04 pm
by spiritquest
Hi there,

I've found one thread and I know what the error means, I just don't know what values or how I can get around this.

I have been building an install locally and am now transferring an SQL dump of the install to the live server.

It runs mySQL 5.027 - I get an error when it try to import the serendipity_exits table.

Code: Select all

SQL query:

CREATE TABLE `serendipity_exits` (
`entry_id` int( 11 ) NOT NULL default '0',
`day` date NOT NULL default '0000-00-00',
`count` int( 11 ) NOT NULL default '0',
`scheme` varchar( 5 ) default NULL ,
`host` varchar( 128 ) NOT NULL default '',
`port` varchar( 5 ) default NULL ,
`path` varchar( 255 ) NOT NULL default '',
`query` varchar( 255 ) default NULL ,
PRIMARY KEY ( `host` , `path` , `day` , `entry_id` ) ,
KEY `exits_idx` ( `entry_id` , `day` , `host` )
) TYPE = MYISAM ;

MySQL said: Documentation
#1071 - Specified key was too long; max key length is 1000 bytes 
Any idea on the best fix .. he collation for the database and tables have been set to utf8.

An update:

the other tables having problems here are:

Code: Select all

serendipity_permalinks

serendipity_plugincategories

Ok another update here.

I had an older version of serendipity installed on the same server so I was able to copy the table structure for serendipity_exits over. i can do the same for serendipity_permalinks, but the problem is the keys on the current version of sernedipity differs to that of the older version .. will this pose a problem, is there a way I can fix this ?

this sql import does not work:

Code: Select all

 CREATE TABLE `ethical_pulse`.`serendipity_permalinks` (
`permalink` varchar( 255 ) COLLATE utf8_unicode_ci NOT NULL default '',
`entry_id` int( 10 ) unsigned NOT NULL default '0',
`type` varchar( 200 ) COLLATE utf8_unicode_ci NOT NULL default '',
`data` text COLLATE utf8_unicode_ci,
KEY `pl_idx` ( `permalink` ) ,
KEY `ple_idx` ( `entry_id` ) ,
KEY `plt_idx` ( `type` ) ,
KEY `plcomb_idx` ( `permalink` , `type` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci 

however this does work

Code: Select all

 CREATE TABLE `ethical_pulse`.`serendipity_permalinks` (
`permalink` varchar( 255 ) COLLATE utf8_unicode_ci NOT NULL default '',
`entry_id` int( 10 ) unsigned NOT NULL default '0',
`type` varchar( 200 ) COLLATE utf8_unicode_ci NOT NULL default '',
`data` text COLLATE utf8_unicode_ci,
KEY `pl_idx` ( `permalink` ) ,
KEY `ple_idx` ( `entry_id` ) ,
KEY `plt_idx` ( `type` ) 
) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci 
the last line containing the key

Code: Select all

KEY `plcomb_idx` ( `permalink` , `type` ) 
must be causing the key length to go over 1000


Thanks,

Ket

Re: 1071 error to do with keys - sql import

Posted: Wed Feb 28, 2007 5:11 pm
by garvinhicking
Hi!

Your MySQL 5 database seems to use UTF-16 for datastorage. Any fulltext/text keys will thus not allocate 255 chars, but instead 510, and together exceeding the maximum length of 1000 characters on some tables. You'll need to convert your Database/Tables to use UTF-8 instead somehow...

There's some more information on this 4-byte storage on the MySQL manual pages, maybe you can research that.

HTH,
Garvin