Having moved servers today, we learned that our MySQL backups were subtly corrupted by an insidious issue that can be difficult to spot until it's too late.
All emoji and high-ascii characters in our database dumps were invalid.
This is due to a behaviour in mysqldump, which defaults the client character set to UTF8 instead of using UTF8MB4 when necessary.
To check if you are affected, review your MySQL dump SQL files and look for lines that look like this:
If you find one, your mysqldump command is not being told to use UTF8MB4, and the emoji data in your database dump will be corrupt.
To fix it, either add the argument
This public service update was brought to you by the letter
All emoji and high-ascii characters in our database dumps were invalid.
This is due to a behaviour in mysqldump, which defaults the client character set to UTF8 instead of using UTF8MB4 when necessary.
To check if you are affected, review your MySQL dump SQL files and look for lines that look like this:
/*!40101 SET character_set_client = utf8 */;
If you find one, your mysqldump command is not being told to use UTF8MB4, and the emoji data in your database dump will be corrupt.
To fix it, either add the argument
--default-character-set=utf8mb4
to your mysqldump command, or else update the appropriate MySQL config file with the following:
Code:
[mysqldump]
default-character-set=utf8mb4