Check Default Character Sets of a MySQL 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)
Updated on: 2020-06-20T07:32:16+05:30

147 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements