I had two options. Stick with latin1 or move to utf8. I chose to move to utf8 as the front end of my website is all in utf8 so making the whole thing utf8 from front to back would make sense. Here is how I did it:
Dumped the original db with the following command:
mysqldump -u root -p --opt --default-character-set=latin1 --skip-set-charset DBNAME > DBNAME<!--
Then using sed I changed all occurrences of the word latin1 to utf8:
sed -e 's/latin1/utf8/g' -i ./DBNAME.sql
From here I then created the new database and then imported the dumpfile.
mysql -p -e "create database DBNAME"
mysql -p --default-character-set=utf8 DBNAME < DBNAME.sql<!--
And that's it.
No comments:
Post a Comment