mysqldump and restore with special characters. øæåØÆÅ

mysqldump character_set_client
mysqldump character-set
mysqldump utf8mb4
mysqldump options
mysqldump change collation
mysqldump --single-transaction
mysqldump compress
mysqldump port

Locally I do this to dump and move a database, upgrading silverstripe 2.3 to 2.4:

mysqldump --opt  --default-character-set=latin1 --skip-set-charset --user=$root -p$password $oldDatabase -r db.sql  

iconv -f LATIN1 -t UTF8 db.sql > db_utf.sql 


CREATE DATABASE $newDatabase CHARACTER SET utf8 COLLATE utf8_swedish_ci; FLUSH PRIVILEGES; GRANT ALL PRIVILEGES ON $newDatabase . * TO '$newUser'@'localhost';  FLUSH PRIVILEGES;
SET NAMES utf8; SOURCE db_utf.sql;

And it works, but on the server Ubuntu 8.04, with mysql Ver 14.12 Distrib 5.0.51a. I get crazy √∏ charterers instead of øæåØÆå.

Anyone know where I've gone wrong?


This worked for me:

  1. ssh the server and connect.
  2. create db dump running

mysqldump -h my_guid.cloud.database.com -u my_user -p my_database_name -r ~/my_db_backup.sql

The console will prompt and ask for the password and there you can type it, my pwd had special characters so i was able to run this command with ease

How to import/export MySQL database with exact character set on , Exporting your database with the correct charset is important in order to avoid problems mysqldump -uUSERNAME -pPASSWORD --default-character-set= utf8� Stack Overflow Public questions and answers; Teams Private questions and answers for your team; Enterprise Private self-hosted questions and answers for your enterprise; Talent Hire technical talent


Try to run with the following command:

mysqldump -u root -p database -r output.sql

instead of redirecting the output with arrow '>'

Dumping and importing from/to MySQL in an UTF-8 safe way , mysqldump -uroot -p database -r utf8.dump. Note that when your MySQL server is not set to UTF-8 you need to do mysqldump --default-character-set=latin1 (!) to � Special Characters in Option Values. To restore a backup created with mysqldump, use the mysql client to import the dump, for example: mysql db_name < backup-file.sql


It took me Two days to find out I had the same problem and solved it when trying to export a database in arabic using mysqldump and each time you open the outputfile in notepad++ its encoding is in ansi and you need it to be utf-8 my code for export and import was as follows it turns out i was right but i was checking the database on the terminal but the terminal doesn't support encoding and i just tried checking it with phpmyadmin and its good don't try to open the file in notepad++ or just try your application directly it will work.

export command

mysqldump -uuser -ppassword --default-character-set=utf8 dbname > outputfile //or even if you use -r instead of > no difference

import command mysql -uuser -ppassword --default-character-set=utf8 dbname < outputfille // please take in mind this does override existing database

Backing up and restoring tables named with special characters, Backing up and restoring tables named with special characters 150707 17:01: 30 mysqlbackup: INFO: Importing table: db.a123 and renaming� That output of mysqldump is working as designed, and it is properly escaped, unless you try to restore the dump on a MySQL instance with SQL_MODE=NO_BACKSLASH_ESCAPES set. There's an outstanding feature request to make mysqldump use a pair of single-quotes to escape literal single-quotes, as per ANSI SQL.


This fixed the issue for me.

  1. Import the double encoded input.sql

  2. Export it again mysqldump -h "$DB_HOST -u "$DB_USER" -p"$DB_PASSWORD" --opt --quote-names --skip-set-charset --default-character-set=latin1 "$DB_NAME" > output.sql

  3. Import clean output.sql

How to restore the database double encoded by mysqldump

The Umlaut Problem, Restore MySQL Databases With Special Characters Using MySQLDumper restoring the backup file to a database, it will then check for the character-set that � To see a list of the options your version of mysqldump supports, issue the command mysqldump --help. Option Syntax - Alphabetical Summary. mysqldump supports the following options, which can be specified on the command line or in the [mysqldump] and [client] groups of an option file.


It's very important to make sure the client is set to UTF8. Confusingly, it's not the same as setting your database to UTF8. Open /etc/my.cnf and make sure you have default-character-set = utf8 under [mysql] not just under [mysqld]

Now you should be able to pipe UTF8 dumps directly into the mysql client. I also recommend using the option --hex-blob on the mysqldump command as mysqldump is not perfect.

How to backup and restore MySQL databases using the mysqldump , If you want to take the backup specific tables, then you can specify the names in the command; “<” OR ”>”: This character indicates whether we� If your tables are primarily MyISAM tables, consider using the mysqlhotcopy instead, for better performance than mysqldump of backup and restore operations. mysqldump can retrieve and dump table contents row by row, or it can retrieve the entire content from a table and buffer it in memory before dumping it. Buffering in memory can be a problem


How To Dump And Import Utf 8 Mysql Databases In A Safe Way , If you have a MySQL database with its character set encoded in UTF-8, then and restoring the database to be able to read its special characters. of dumping a database with mysqldump does not treat utf-8 encoding right. I am testing my backup and restore procedure for a Wikimedia installation. I performed a backup of the database (using phpMyAdmin and also mysqldump) and then a restore and all the article titles that contained special Romanian characters were corrupted. Titles without special characters were not affec


mysqldump, Dump a database or a collection of databases in a portable format. Group Options; Special Characters in Option Values. Option Files. Option Groups. NULL � mysqldump -uroot -p database -r utf8.dump Note that when your MySQL server is not set to UTF-8 you need to do mysqldump --default-character-set=latin1 (!) to get a correctly encoded dump. In that case you will also need to remove the SET NAMES='latin1' comment at the top of the dump, so the target machine won't change its UTF-8 charset when


4.5.4 mysqldump — A Database Backup Program, mysqldump output can include ALTER DATABASE statements that change the However, UTF-16 is not permitted as a connection character set (see --create- options, Include all MySQL-specific table options in CREATE TABLE statements. In this article, I am going to explain how we can use mysqldump to generate the backup of the MySQL database. Generate backup using mysqldump utility. Mysqldump is a command-line utility that is used to generate the logical backup of the MySQL database. It produces the SQL Statements that can be used to recreate the database objects and data.