Every database has a database character set and a database collation, which may not be null. The CREATE DATABASE and ALTER DATABASE commands now have optional clauses for specifying the database character set and collation:
CREATE DATABASE db_name [DEFAULT CHARACTER SET character_set_name [COLLATE collation_name]] ALTER DATABASE db_name [DEFAULT CHARACTER SET character_set_name [COLLATE collation_name]]
Example:
CREATE DATABASE db_name DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
MySQL chooses the database character set and database collation thus:
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.
Otherwise, the server character set and server collation.
MySQL's CREATE DATABASE ... DEFAULT CHARACTER SET ... syntax is analogous to the standard-SQL CREATE SCHEMA ... CHARACTER SET ... syntax. Because of this, it is possible to create databases with different character sets and collations, on the same MySQL server.
The database character set and collation are used as default values if the table character set and collation are not specified in CREATE TABLE statements. They have no other purpose.