Created
July 27, 2015 13:03
-
-
Save okovpashko/6b12f7c0fefdf92dfd25 to your computer and use it in GitHub Desktop.
Convert utf8 DB with latin1 data to utf8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump --user=username --password=password --default-character-set=latin1 --skip-set-charset dbname > dump.sql | |
sed -i -E 's/latin1/utf8/g' dump.sql | |
mysql --user=username --password=password --execute="DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;" | |
mysql --user=username --password=password --default-character-set=utf8 dbname < dump.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment