Last active
August 29, 2015 13:58
-
-
Save andretw/10347478 to your computer and use it in GitHub Desktop.
SQL to select and change the collation from one to another. (utf8, for example.)
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
# ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci; | |
# ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; | |
SELECT CONCAT("ALTER TABLE ",TABLE_SCHEMA,".",TABLE_NAME," CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;") AS alter_sql | |
FROM information_schema.TABLES | |
WHERE TABLE_SCHEMA = 'cms'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment