DEV Community

Katz Ueno
Katz Ueno

Posted on

1 1

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

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more