Mengatasi Issue #1071 – Specified key was too long; max key length is 767 bytes

Issue #1071 – Specified key was too long; max key length is 767 bytes ini muncul pada saat hendak melakukan import data mysql ke database.

# mysql -u root database_web < database_web.sql 
ERROR 1071 (42000) at line 1172: Specified key was too long; max key length is 767 bytes

Cara memperbaikinya adalah sebagai berikut:

  • Masuk ke dalam command line MySQL/MariaDB:
# mysql -u root
  • Muncul tampilan konsol MySQL/MariaDB seperti berikut:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 377
Server version: 10.1.37-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
  • Kemudian ketikkan perintah berikut:
SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_large_prefix=on;

Lakukan proses import dan seharusnya issuenya solved 😀

Sekian dan terima kasih, semoga bermanfaat ya.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top