How can I preserve Unicode characters in `mysqdump`?
August 28, 2006 11:55 AM Subscribe
How can I make backups of a MySQL database (via
mysqldump) and preserve Unicode characters (such as em dashes)?
I use
mysqldump and
rsync to make backups of my
TextDrive account. One of the forums I run, however, often includes unencoded Unicode entities, such as em dashes and bullets.
Because these characters aren't straight ASCII, restoring from previous
mysqldump backups has mangled them, producing gibberish but preserving the other, straight ASCII text in the database.
My current
mysqldump call looks like this:
/usr/local/bin/mysqldump -uuser -ppassword --quote-names --complete-insert --extended-insert --quick --lock-tables=false --skip-add-locks --all-databases | gzip > db.sql. What's necessary to preserve these Unicode characters?
Thanks.
posted by cmyers to computers & internet (8 answers total) 2 users marked this as a favorite
A little searching (actually, just stuffing "mysqldump unicode" into google) suggests that the argument --default-character-set=utf8 is what you want.
posted by pharm at 12:03 PM on August 28, 2006