Logo

dev-resources.site

for different kinds of informations.

How To Check mysqldump character-set

Published at
6/9/2021
Categories
mysql
mariadb
mysqldump
utf8
Author
katzueno
Categories
4 categories in total
mysql
open
mariadb
open
mysqldump
open
utf8
open
Author
8 person written this
katzueno
open
How To Check mysqldump character-set

Learning from mistake.

mysqldump doesn't respect database's collation, but mysql client.

Check your mysqldump default character set by typing

mysqldump --help | grep default-character-set
Enter fullscreen mode Exit fullscreen mode

You always want to add --default-character-set option

Example

mysqldump -h {$host} -u {$db_username} --password="{$db_password}" --default-character-set=utf8mb4 --single-transaction {$db_name} > {$SQL_file_name}
Enter fullscreen mode Exit fullscreen mode

--single-transition option is my preferences for the database which mainly uses InnoDB

Featured ones: