This article provides three ways to return the collation of a database in MySQL.
The following statement can be used to check the default character set and collation for a given database:
USE Music; SELECT @@character_set_database, @@collation_database;
Example result:
+--------------------------+----------------------+ | @@character_set_database | @@collation_database | +--------------------------+----------------------+ | utf8 | utf8_general_ci | +--------------------------+----------------------+
This example shows the collation for a database called Music
. First, we switch to that database, then we do the SELECT
statement to return system variables for the character set and the collation.
Continue reading