PDA

View Full Version : Mysql latin1 to utf8


phppete
07-21-2008, 03:35 PM
I've just converted my local mysql5 to utf8 from latin1, a bit of a pain on Mac OSX but finally it is done and working as expected


For any lost souls searching for help with this, on my Mac I did not have a my.cnf file so I created one, the following has worked:

[mysqld]
init-connect='SET NAMES utf8'
character-set-server=utf8
character-set-client=utf8
collation-server=utf8_general_ci
default-collation=utf8_general_ci
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8

I have a question, I have almost 200 databases locally, is there a faster method of converting them to utf8 other than dumping and reloading one by one?

Thanks

hobbes
07-21-2008, 05:33 PM
What version are you upgrading from? You should be able to use ALTER, but may have extra steps if upgrading from 4.0 vs. 4.1. Perhaps the following will help:
http://dev.mysql.com/doc/refman/4.1/en/charset-conversion.html
http://dev.mysql.com/doc/refman/5.0/en/charset-conversion.html