Created
February 26, 2016 00:44
-
-
Save coryodaniel/8aaff31a1fb58a24c61a to your computer and use it in GitHub Desktop.
MySQL Collation and Character Set export to CSV
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
| MySQL Collation Checkup | |
| SELECT @@character_set_database, @@collation_database | |
| INTO OUTFILE '/tmp/table_defaults_charset.csv' | |
| FIELDS TERMINATED BY ',' | |
| OPTIONALLY ENCLOSED BY '"' | |
| LINES TERMINATED BY '\n'; | |
| SELECT * FROM information_schema.schemata | |
| INTO OUTFILE '/tmp/schema_charset.csv' | |
| FIELDS TERMINATED BY ',' | |
| OPTIONALLY ENCLOSED BY '"' | |
| LINES TERMINATED BY '\n'; | |
| SELECT t.table_name, ccsa.character_set_name, ccsa.collation_name | |
| FROM | |
| information_schema.TABLES t, | |
| information_schema.COLLATION_CHARACTER_SET_APPLICABILITY ccsa | |
| WHERE | |
| ccsa.collation_name = t.table_collation | |
| AND t.table_schema = "YOUR_NAME_HERE" | |
| ORDER BY | |
| t.table_name | |
| INTO OUTFILE '/tmp/table_charset.csv' | |
| FIELDS TERMINATED BY ',' | |
| OPTIONALLY ENCLOSED BY '"' | |
| LINES TERMINATED BY '\n'; | |
| SELECT table_name, column_name, character_set_name, collation_name, column_type | |
| FROM information_schema.columns | |
| WHERE table_schema = "YOUR_NAME_HERE" | |
| ORDER BY table_name, column_name | |
| INTO OUTFILE '/tmp/column_charset.csv' | |
| FIELDS TERMINATED BY ',' | |
| OPTIONALLY ENCLOSED BY '"' | |
| LINES TERMINATED BY '\n'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment