You are currently viewing Solved: phpIPAM – ERROR 1071 (42000) at line 369: Specified key was too long; max key length is 767 bytes

Solved: phpIPAM – ERROR 1071 (42000) at line 369: Specified key was too long; max key length is 767 bytes

Issue

When installing phpIPAM, users may receive the following error code when trying to import the SQL file SCHEMA.sql:

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

Solution

The error is caused by the default character set being used in the SCHEMA.sql file. Changing the default character set to utf8 will fix the issue.

To modify the file, enter the commands below:

Modify the SCHEMA.sql file

nano /var/www/html/phpipam/db/SCHEMA.sql

Change the default character set on line 369 to the following

ENGINE=InnoDB DEFAULT CHARSET=utf8;

Save the configuration change

CTRL & X

Import the SQL file again

sudo mysql -u root -p phpipam < /var/www/html/phpipam/db/SCHEMA.sql

If you encounter the following error after trying to run the above command you will need to remove the phpipam database and then create it again before running the command again. The following steps highlight how to remove the phpipam database and create another one.

 mysql -u root -p

Confirm that the phpipam database exists

SHOW DATABASES;

Remove the phpipam database and exit

DROP DATABASE phpipam;
EXIT;

Import the SQL file again

sudo mysql -u root -p phpipam < /var/www/html/phpipam/db/SCHEMA.sql

iwiizkiid

Kelvin is a Cyber Security professional with years and experience working with organisations in different verticals, both large and small. He enjoys contributing to the Network Wizkid knowledge base and he also creates technical content. Kelvin enjoys learning new things and often does this by working on achieving new technical certifications. He holds many professional certifications and academically, he has achieved a Bachelors and Master's degree in both Computer Networks and Cyber Security.

Leave a Reply