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.

3
  • 1
    Shouldn't you be enjoying Christmas Day, instead of posting here? Dec 25, 2010 at 15:22
  • 1
    Shouldn't you be enjoying Xmas, instead of commenting? :D Not everyone celebrates Xmas! Dec 25, 2010 at 21:46
  • I don't enjoy christmas. My iphone's decided to break finally today. Best Xmas Ever (!) Dec 25, 2010 at 21:49

2 Answers 2

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
1
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;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .