Mysqldump not exporting emojis correctly – MySQL

โš ๏ธ Problem?

When using mysqldump tool from your command line (such as my Ubuntu 18.04 server) I found the default settings were not exporting the emoji characters correctly. Wrong charset. It was leaving ??? instead of the actual emoji entity.

๐Ÿ’ก How to fix it?

Define the utf8mb4 charset when exporting your database:

--default-character-set=utf8mb4

Export

mysqldump --default-character-set=utf8mb4 -u your_user -p database_name > file.sql

Import

mysql -u your_user -p database_name < file.sql

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*