Created
August 5, 2012 13:43
-
-
Save Amitesh/3264898 to your computer and use it in GitHub Desktop.
Check Database, table and columns character set in mysql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT default_character_set_name FROM information_schema.SCHEMATA S | |
WHERE schema_name = "database_name"; | |
show FULL columns from table_name; | |
For Schemas: | |
SELECT default_character_set_name FROM information_schema.SCHEMATA S | |
WHERE schema_name = "schemaname"; | |
For Tables: | |
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 = "schemaname" | |
AND T.table_name = "tablename"; | |
For Columns: | |
SELECT character_set_name FROM information_schema.`COLUMNS` C | |
WHERE table_schema = "schemaname" | |
AND table_name = "tablename" | |
AND column_name = "columnname"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment