UTF-8 in MySQL

January 8, 2012 — Mike Hommé
Mike Hommé's picture

Just fixed what I thought was going to be a big pain in the ass problem. The post below is from another website but reposting here to keep track of it.

- Mike

From here:
http://www.farinspace.com/utf8-in-mysql/

I’ve just fixed an issue where values were not properly being stored as UTF-8 in MySQL. The problem turned out to be the need of a few my.cnf config settings. I don’t claim to know much about the inner workings of MySQL, simply because that is not where most of my time is spent. But I wanted to share the solution that worked in my particular case:

MySQL version: 5.1.41 (Ubuntu Linux)


[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci; SET NAMES utf8;'
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake