[ MySQL 5.5.54 : utf8mb4 ] Mysql2::Error: Specified key was too long; max key length is 767 bytes

Problem

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

Solution

mysql-server in Ubuntu 12.04.5 LTS will be version 5.5.54.

We need version 5.7 that enable `innodb_large_prefix` by default.

$ wget http://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.0-1_all.deb
$ sudo apt-get update
$ sudo apt-get install mysql-server

After this, mysql-server will be version 5.7.

 

NOTE : to view innodb_large_prefix environment variable

show variables like 'innodb_large_prefix';

+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| innodb_large_prefix | ON |
+---------------------+-------+
1 row in set (0.00 sec)

 

 

Another Problem

> show variables like 'innodb_large_prefix';

Table 'performance_schema.session_variables' doesn't exist

Solution

sudo mysql_upgrade -u root -p --force

sudo /etc/init.d/mysql restart

 

ref : https://askubuntu.com/questions/750498/mysql-5-5-update-to-mysql-5-7,

http://stackoverflow.com/questions/6172798/mysql-varchar255-utf8-is-too-long-for-key-but-max-length-is-1000-bytes,

http://stackoverflow.com/questions/31967527/table-performance-schema-session-variables-doesnt-exist

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s