Search code examples
mysqlutf-8character-encodingutf8mb4

#1115 - Unknown character set: 'utf8mb4'


I have a local webserver running on my pc to which I use for local development. I'm now at the stage of exporting the database and importing onto my hosted VPS.

When exporting then importing I get the following error!

1115 - Unknown character set: 'utf8mb4'

Can somebody point me in the right direction?


Solution

  • The error clearly states that you don't have utf8mb4 supported on your stage db server.

    Cause: probably locally you have MySQL version 5.5.3 or greater, and on stage/hosted VPS you have MySQL server version less then 5.5.3

    The utf8mb4 character sets was added in MySQL 5.5.3.

    utf8mb4 was added because of a bug in MySQL's utf8 character set. MySQL's handling of the utf8 character set only allows a maximum of 3 bytes for a single codepoint, which isn't enough to represent the entirety of Unicode (Maximum codepoint = 0x10FFFF). Because they didn't want to potentially break any stuff that relied on this buggy behaviour, utf8mb4 was added. Documentation here.


    Solution 1: Simply upgrade your MySQL server to 5.5.3 (at-least) - for next time be conscious about the version you use locally, for stage, and for prod, all must have to be same. A suggestion - in present the default character set should be utf8mb4.


    Solution 2 (not recommended): Convert the current character set to utf8, and then export the data - it'll load ok.