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

About 

Sreejit is the founder of Server Management Plus. His motto is "If there's an easier way, Why do it any other way" and following it, he has created a lots of automation scripts for the company using which we are able to resolve issue at an extremely fast rate and save lots of time. He has a very keen interest in new technologies and spend most of his free time online researching about it apart from listening music and watching movies.