0

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?

1 Answer 1

1

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.

2
  • 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, 2010 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, 2010 at 5:06

You must log in to answer this question.

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