I am attempting to dump my database, which is set to, and only contains, utf8mb4
and appropriate collations. I use the following line:
mysqldump --add-drop-table --add-locks --allow-keywords --complete-insert=TRUE --compress --create-options --databases [database] --default-character-set=utf8mb4 --disable-keys --dump-date --extended-insert=FALSE --hex-blob --lock-tables=FALSE --no-autocommit --no-data --set-charset --order-by-primary --quote-names --routines --single-transaction --skip-quick --triggers -u [user] -h [server] > dump.sql
This works well and produces the output I want, with one exception. My dump is littered with this:
/*!40101 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
I have read up on conditional comments, and as I understand it, this will always get executed on our clients/servers (Server Version: 5.6.46 - MySQL Community Server (GPL)). I don't understand why this is set to utf8
instead of utf8mb4
, and would like it to reflect our proper charset.
None of the existing answers to this problem have helped me.
Edit: I originally had an incorrect version in my post
SHOW VARIABLES LIKE 'char%';
mysqldump
. Runningmysql
with similar parameters results incharacter_set_client = utf8mb4, character_set_connection = utf8mb4, character_set_database = utf8mb4, character_set_filesystem = binary, character_set_results = utf8mb4, character_set_server = latin1, character_set_system = utf8
, all of which seems correct. As @Isotopp pointed out, the problem seems to be in the source code.