User Tools

Site Tools


db:setutf8

Setting UTF-8 on mysql server

First step, login into mysql server and check the status of the involved variables:

mysql > SHOW VARIABLES LIKE 'character_set%';
mysql > SHOW VARIABLES LIKE 'collation%';

If you see something like this, then everything is ok

mysql> SHOW VARIABLES LIKE 'character_set%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

Otherwise, in your mysql config file (/etc/my.cnf for example), make sure you have:

[mysqld]
...
skip-character-set-client-handshake
character-set-server=utf8
collation-server=utf8_general_ci
...

db/setutf8.txt · Last modified: 2013/03/16 17:40 (external edit)