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