views:

671

answers:

2

When I create a new MySQL database through phpMyAdmin, I have the option to choose the collation (e.g.-default, armscii8, ascii, ... and UTF-8). The one I know is UTF-8, since I always see this in HTML source code. But what is the default collation? What are the differences between these choices, and which one should I use?

+2  A: 

Collation is not actually the default, it's giving you the default collation as the first choice.

What we're talking about is collation, or the character set that your database will use in its text types. Your default option is usually based on regional settings, so unless you're planning to globalize, that's usually peachy-keen.

Collations also determine case and accent sensativity (i.e.-Is 'Big' == 'big'? With a CI, it is). Check out the MySQL list for all the options.

Eric
How about UTF-8? I saw wordpress using UTF-8? Should I use UTF-8??
bbtang
UTF-8 is Unicode. If you're not in an English-speaking country, it's a very good bet to use it.
Eric
I see. Our project is targeting US and the whole world, so I think it would be better if we use UTF-8, am I right?
bbtang
Yes you are. That's definitely a safe collation.
Eric
Thanks for the help eric
bbtang
A: 

Collation tells database how to perform string matching and sorting. It should match your charset.

If you use UTF-8, the collation should be utf8_general_ci. This will sort in Unicode order (case-insensitive) and it works for most languages. It also preserves ASCII and Latin1 order.

The default collation is normally latin1.

ZZ Coder