How can we check the default character sets of a particular MySQL database?

MySQLMySQLi Database

Following is the query to check default character set of the particular MySQL database −

mysql> SELECT SCHEMA_NAME 'DatabaseName', default_character_set_name 'Charset' FROM information_schema.SCHEMATA where schema_name = 'db_name';

Example

For example, the query below will return the default character set of a database named ‘Sample’ −

mysql> SELECT SCHEMA_NAME 'DatabaseName', default_character_set_name 'Charset' FROM information_schema.SCHEMATA where schema_name = 'Sample';
+----------------+---------+
| DatabaseName   | Charset |
+----------------+---------+
| Sample         | latin1  |
+----------------+---------+
1 row in set (0.00 sec)
raja
Published on 19-Feb-2018 17:00:36
Advertisements