Forked from dschneider/convert_utf8_to_utf8mb4
Last active
September 19, 2015 14:32
-
-
Save RobbiNespu/518c64be732ad3c15b9d to your computer and use it in GitHub Desktop.
How to easily convert utf8 tables to utf8mb4 in MySQL 5.5
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
# For each database: | |
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; | |
# For each table: | |
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | |
# For each column: | |
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | |
# (Don’t blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a `VARCHAR` column.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment