Skip to content

Instantly share code, notes, and snippets.

@haraldmartin
Created February 21, 2012 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haraldmartin/1877094 to your computer and use it in GitHub Desktop.
Save haraldmartin/1877094 to your computer and use it in GitHub Desktop.
Convert database to UTF-8
mysqldump --user=username --password --default-character-set=latin1 --skip-set-charset dbname > dump.sql
sed 's/latin1/utf8/g' dump.sql > dump_utf.sql
mysql --user=username --password --execute="DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;"
mysql --user=username --password --default-character-set=utf8 dbname < dump_utf.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment