For some reason, the current version of MySQL defaults to using the latin1 encoding. I needed to get Unicode support with UTF-8 encoding working a little while ago, so I might as well write down what to do. It’s pretty simple.
Go edit your my.cnf file (mine was located in /etc/mysql/my.cnf).
At the end of the [client] section, add this :
default-character-set = utf8
At the end of the [mysqld] section, add this:
character-set-server = utf8
And then restart MySQL — e.g. sudo /etc/init.d/mysql restart
After this, any NEW MySQL tables you create should automatically default to using UTF-8 in queries.
Comments