Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
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
add comment

2 Answers

up vote 2 down vote accepted

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
share|improve this answer
    
ha, thx... that's a good one. –  Julien Genestoux Dec 25 '10 at 21:47
add comment

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;
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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