Migrate from MySQL 4.0 to MySQL 5.0

I just tried to migrate an old MySQL 4.0 installation to MySQL 5.0. Most of the dumps worked smooth but there was a MediaWiki dump which raised the following error:

ERROR 1071 (42000) at line 66: Specified key was too long; max key length is 1000 bytes

On this page is described what the error means:

Basically your new 5.0 DB defaults to utf-8 encoding. Type STATUS; in your mysql shell to find out. Your old dump is most likely latin1 encoded and there is a problem when you import it and your index keys are longer than 1000 byte. This is because MySQL 5.0 uses 3 bytes for every character.

The solution to this is that you edit /etc/my.cnf and insert /set the following lines:


[server]
default-character-set=latin1
[client]
default-character-set=latin1

Leave a Reply

Your email address will not be published. Required fields are marked *