Last active
September 19, 2020 09:34
-
-
Save xeoncross/5d85c3f5547ee04d5bd81113a2c8ec4d to your computer and use it in GitHub Desktop.
Make MySQL FULLY support utf8 glyphs including smilie faces and emoji.
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
[client] | |
default-character-set = utf8mb4 | |
[mysql] | |
default-character-set = utf8mb4 | |
[mysqld] | |
character-set-server = utf8mb4 | |
collation-server = utf8mb4_unicode_ci | |
#init_connect='SET collation_connection = utf8mb4_unicode_ci' | |
#init_connect='SET NAMES utf8mb4' | |
# If you have trouble with "ERROR 1071 (42000): Specified key was too long; max key length is ____ bytes" | |
#innodb-large-prefix=true | |
#skip-character-set-client-handshake | |
character-set-client-handshake = FALSE |
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 table_name CHARACTER SET utf8mb4; | |
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; | |
SHOW VARIABLES LIKE 'character\_set\_%'; | |
ALTER TABLE table_name MODIFY COLUMN text_name VARCHAR(140) CHARACTER SET utf8mb4; | |
REPAIR TABLE table_name; | |
OPTIMIZE TABLE table_name; | |
-- $ mysqlcheck -u root -p --auto-repair --optimize --all-databases | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a quick, installable version: https://gist.github.com/Xeoncross/2d0503cee10a6374c627f0faaed9ea3f