1

Our whole application is now able to handle UTF-8 and it will be our choice in terms of encoding all across our architecture. The last step is to change the encoding of our MySQL databases.

Of course, ALTER TABLE db_table CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; should be able to convert each of the tables to the right UTF8 encoding, yet, is there anything else I should do? I believe that the my.cnf configuration file needs to be changed as well.

Julien Genestoux
  • 609
  • 8
  • 19

2 Answers2

2

Copy and paste this into a terminal and restart the Mysql server to change the default character encoding.

cat << EOF > /etc/mysql/conf.d/utf8.cnf

[mysqld]
default-character-set=utf8

[client]
default-character-set=utf8

EOF
Zoredache
  • 130,897
  • 41
  • 276
  • 420
iscsi
  • 56
  • 3
0

You should also set the character-set from your client application by these sql statements:

SET character_set_client = utf8;
SET character_set_results = utf8;
SET character_set_connection = utf8;
lg.
  • 4,649
  • 3
  • 21
  • 20