I'm using mysqldump to dump my database that contains UTF8MB4 columns with UTF8MB4 data. When I import this .sql
file into a new database with UTF8MB4 support, all UTF8MB4 characters are converted into ????
. Anybody got a clue about how to make MySQL and import work with UTF8MB4?
To solve the problem open the exported SQL file, search and replace the utf8mb4 with utf8 , after that search and replace the utf8mb4_unicode_520_ci with utf8_general_ci . Save the file and import it into your database. After that, change the wp-config. php charset option to utf8 , and the magic starts.
The difference between utf8 and utf8mb4 is that the former can only store 3 byte characters, while the latter can store 4 byte characters. In Unicode terms, utf8 can only store characters in the Basic Multilingual Plane, while utf8mb4 can store any Unicode character.
mysqldump ( mysqldump -C ) also supports compressed communication which could perhaps make things transfer faster over the network.
No, it does not export indexes. Indexes are rebuilt upon loading the mysqldump back into mysql.
You should specify the character set with --default-character-set=utf8mb4
option when using mysqldump
.
$ mysqldump --default-character-set=utf8mb4 -uusername -p database > dump.sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With