Character Sets
- List available character sets
- SHOW CHARACTER SET;
- List collation for character set
- SHOW COLLATION LIKE 'latin1%';
- Find character set and collation for a specific database
- SHOW CREATE DATABASE databasename;
- Find character set and collation for a specific table
- SHOW CREATE TABLE tablename;
- Find character set and collation for columns
- SHOW FULL COLUMNS FROM tablename;
Changing/Setting the Character Set
Initially, the server character set and collation depend on the options that you use when you start mysqld. You can use –character-set-server for the character set. Along with it, you can add –collation-server for the collation. If you don't specify a character set, that is the same as saying –character-set-server=latin1. If you specify only a character set (for example, latin1) but not a collation, that is the same as saying –character-set-server=latin1 –collation-server=latin1_swedish_ci because latin1_swedish_ci is the default collation for latin1.
Notes
- Two different character sets cannot have the same collation.
- Each character set has one collation that is the default collation. For example, the default collation for latin1 is latin1_swedish_ci. The output for SHOW CHARACTER SET indicates which collation is the default for each displayed character set.
- There is a convention for collation names: They start with the name of the character set with which they are associated, they usually include a language name, and they end with _ci (case insensitive), _cs (case sensitive), or _bin (binary).