MySQL - Get Database Character Set and Collation

You can use the following query to see the database character set and collation:

-- Read database character sets and collations
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA;

Sample output:

CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
def information_schema utf8 utf8_general_ci NULL
def mysql latin1 latin1_swedish_ci NULL
def performance_schema utf8 utf8_general_ci NULL
def target latin1 latin1_swedish_ci NULL
def test latin1 latin1_swedish_ci NULL

Additionally, you can execute the following query to get the character set and collation for the current database:

USE <db_name>;
SELECT @@character_set_database, @@collation_database;

Sample output:

latin1 latin1_swedish_ci