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.

  • 1
    Shouldn't you be enjoying Christmas Day, instead of posting here? – Tom O'Connor Dec 25 '10 at 15:22
  • 1
    Shouldn't you be enjoying Xmas, instead of commenting? :D Not everyone celebrates Xmas! – Julien Genestoux Dec 25 '10 at 21:46
  • I don't enjoy christmas. My iphone's decided to break finally today. Best Xmas Ever (!) – Tom O'Connor Dec 25 '10 at 21:49
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
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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.