MySQL Set Default Character Set and Collation

I am getting fed up with all the databases on my server being set to latin1 with a Swedish collation, I guess I am just being anal, anyhow. I found out how to configure MySQL so that it always uses utf8. Add the following lines to your /etc/mysql/my.cnf under the mysqld section:

init-connect='SET NAMES utf8'
default-character-set=utf8
default-collation=utf8_unicode_ci
character-set-server=utf8

Leave a Reply


Content Copyright © 2005-2008 Chris Smith. All Rights Reserved.