Search This Blog

Powered by Blogger.

Blog Archive

Aug 19, 2019

Fix Error utf8mb4

Posted by Putra Mahakam On August 19, 2019
How to solve the Error 1115 (42000):
Unknown character set: 'utf8mb4' when importing a sql file in PHPMyAdmin.

This error usually happens when you try to import an entire database, or single table that was exported from a newer version of PHPMyAdmin. So when you try to import this file into an older version of MySQL that doesn't support the utf8mb4 charset, you will face the exception. The most probably case is that locally you have a major version of MySQL, and on stage/hosted VPS you have MySQL server version less than 5.6.34-1.



Check the following users.sql file:

As you can see, if this table is imported in some database of your PHPMyAdmin with a version of MySQL lower to 5.6.34-1, the following line will throw the known exception:

How to solve it

There's a good chance (depending of the kind of characters stored on your table) that you can solve this issue by simply changing the utf8mb4 with just utf8. According to the MySQL docs, the utf8mb4 charset is a superset of utf8 that uses a maximum of four bytes per character and supports supplementary characters (instead of 3 that uses utf8).
/*!40101 SET NAMES utf8 */;
Alternatively, if you are able to, you can update the version of MySQL installed on your server that supports the utf8mb4 charset.

Site search