MySQL Error while importing database – Specified key was too long; max key length is 1000 bytes

mysql-error-specified-key-was-too-long

While importing/transferring/compying database from one server to another sometimes you may get below error

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

I am not sure why this error occurs and there were lots of solutions available on the internet.  Below is the solution that worked for me.  I can’t say that it will work for you too but you can give it a try.

First of all stop the mysql service.

/etc/init.d/mysql stop

The remove the ib_logfile0 & ib_logfile1 from /var/lib/mysql or where ever your mysql data directory is.

cd /var/lib/mysql
mv ib_logfile0 ib_logfile0-backup
mv ib_logfile1 ib_logfile1-backup

Then start the mysql and import the database again

/etc/init.d/mysql start
mysql database_name < database.sql