Last active
September 18, 2018 12:34
-
-
Save kitzberger/08dd20ae8b9de333d3c444d3efa76fd4 to your computer and use it in GitHub Desktop.
This file contains 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
-- Find out what charset and collation the DB has: | |
SELECT SCHEMA_NAME 'database', default_character_set_name 'charset', DEFAULT_COLLATION_NAME 'collation' | |
FROM information_schema.SCHEMATA; | |
-- Find out what charset and collation the tables have: | |
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 | |
-- Change charset and collation of DB: | |
ALTER DATABASE some_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment