User Tools

Site Tools


db:setutf8

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

db:setutf8 [2013/03/16 17:40] (current)
Line 1: Line 1:
 +==== Setting UTF-8 on mysql server ====
  
 +
 +First step, login into mysql server and check the status of the involved variables:
 +
 +<​code>​
 +mysql > SHOW VARIABLES LIKE '​character_set%';​
 +mysql > SHOW VARIABLES LIKE '​collation%';​
 +</​code>​
 +
 +If you see something like this, then everything is ok
 +
 +<​code>​
 +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)
 +</​code>​
 +
 +Otherwise, in your mysql config file (/​etc/​my.cnf for example), make sure you have:
 +
 +<​code>​
 +[mysqld]
 +...
 +skip-character-set-client-handshake
 +character-set-server=utf8
 +collation-server=utf8_general_ci
 +...
 +</​code>​
db/setutf8.txt ยท Last modified: 2013/03/16 17:40 (external edit)