public
Created

Convert database to UTF-8

  • Download Gist
convert.sh
Shell
1 2 3 4
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.