4. 20. 3. Every database has a database character set and a database collation. |
|
The CREATE DATABASE and ALTER DATABASE statements have optional clauses for specifying the database character set and collation: |
All database options are stored in a text file named db.opt that can be found in the database directory. |
CREATE DATABASE db_name
[[DEFAULT] CHARACTER SET charset_name]
[[DEFAULT] COLLATE collation_name]
ALTER DATABASE db_name
[[DEFAULT] CHARACTER SET charset_name]
[[DEFAULT] COLLATE collation_name]
|
|
CREATE DATABASE db_name CHARACTER SET X COLLATE Y;
|
|
If both CHARACTER SET X and COLLATE Y were specified, then character set X and collation Y. |
If CHARACTER SET X was specified without COLLATE, then character set X and its default collation. |
If COLLATE Y was specified without CHARACTER SET, then the character set associated with Y and collation Y. |
Otherwise, the server character set and server collation. |
Quote from MySQL document http://www.mysql.com |
CREATE DATABASE db_name CHARACTER SET latin1 COLLATE latin1_swedish_ci;
|
|