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.

Using the latest version of MySql. I created a database, it defaulted to Latin1_Swedish, and just noticed that the 'mysql' database also has Latin1_Swedish. Only the information_schema has a collation of utf8_general_ci. Should I be changing my database to utf8? And if so, how?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

There are a few options to change from the default latin1_swedish setting

You can compile mysql to have a default character set of utf8

make WITH_CHARSET=utf8 WITH_COLLATION=utf8_bin

You can change the defaults within the my.cnf file, or at runtime of the mysql server.

mysqld --character-set-server=utf8 --collation-server=utf8_bin;

You can also specify the characterset when creating your databases.

CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_bin;

Whether you should or not, is your call.

Here's some docs on the topic, which might be worth having a look through.

share|improve this answer
    
In the third line COLLATE settings are added. Not really equivalent with the two earlier lines. Any particular reason why you recommend utf8_bin? –  andol Jun 7 '10 at 4:56
    
Not especially, it depends on what your application is really. It changes the way mysql executes queries. utf8_bin will compare strings by the binary value of each character in the string, whereas utf8_general_ci will compare using general language rules, and be case-insensitive. I'll update the other lines to match. –  LukeR Jun 7 '10 at 5:06

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.