How To get Default Character set of Database And Table in mysql

 If you want to know your mysql database default character set then use this
query

SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA S WHERE schema_name=”DATABASE_NAME”;

Output:

+—————————-+
| DEFAULT_CHARACTER_SET_NAME |
+—————————-+
| latin1                     |
+—————————-+

Get Table database default character set using this query

 SELECT CCSA.character_set_name FROM information_schema.`TABLES` T,
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA WHERE CCSA.collation_name = T.table_collation AND T.table_schema = “DATABASE_NAME” AND T.table_name = “TABLE_NAME”;

Output:

+——————–+
| character_set_name |
+——————–+
| latin1             |
+——————–+

 

Leave a Reply

Your email address will not be published. Required fields are marked *

94 − = 86