Error: Specified key was too long; max key length is 767 bytes

Post Reply
User avatar
isscbta
Posts: 39
Joined: Mon Jul 19, 2021 1:41 am

In case you see this error during the import of the database:
Specified key was too long; max key length is 767 bytes
or
Index column size too large. The maximum column size is 767 bytes:


Those are steps to fix this:
1. In your SSH, as root, run:

Code: Select all

vi /etc/mysql/mariadb.cnf
At the end of this file add this:

Code: Select all

innodb-file-format=barracuda
innodb-file-per-table=ON
innodb-large-prefix=ON
innodb_default_row_format = 'DYNAMIC'
2. After that restart MySQL server:

Code: Select all

systemctl restart mysql
3. At the end, in the table where the error code is shown, run this SQL query:

Code: Select all

ALTER TABLE `table_name` ROW_FORMAT=DYNAMIC;

Tags:
Post Reply