ERROR 1115 (42000): Unknown character set: 'utf8mb4'

saravanakumar picture saravanakumar · Feb 20, 2014 · Viewed 231.8k times · Source

I have a MySQL dump, which I tried to restore with:

mysql -u"username" -p"password" --host="127.0.0.1" mysql_db < mysql_db

However, this threw an error:

ERROR 1115 (42000) at line 3231: Unknown character set: 'utf8mb4'

This is lines 3231-3233:

/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_general_ci */ ;

I am using MySQL 5.1.69. How can I solve this error?

Answer

Nanne picture Nanne · Feb 21, 2014

Your version does not support that character set, I believe it was 5.5.3 that introduced it. You should upgrade your mysql to the version you used to export this file.

The error is then quite clear: you set a certain character set in your code, but your mysql version does not support it, and therefore does not know about it.

According to https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html :

utf8mb4 is a superset of utf8

so maybe there is a chance you can just make it utf8, close your eyes and hope, but that would depend on your data, and I'd not recommend it.