1ALTER DATABASE databasename CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
2ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
1mysql> SHOW VARIABLES LIKE 'char%'; SHOW VARIABLES LIKE 'collation%';
2+--------------------------+----------------------------+
3| Variable_name | Value |
4+--------------------------+----------------------------+
5| character_set_client | utf8mb4 |
6| character_set_connection | utf8mb4 |
7| character_set_database | utf8mb4 |
8| character_set_filesystem | binary |
9| character_set_results | utf8mb4 |
10| character_set_server | utf8mb4 |
11| character_set_system | utf8 |
12| character_sets_dir | /usr/share/mysql/charsets/ |
13+--------------------------+----------------------------+
148 rows in set (0.00 sec)
15
16+----------------------+--------------------+
17| Variable_name | Value |
18+----------------------+--------------------+
19| collation_connection | utf8mb4_general_ci |
20| collation_database | utf8mb4_unicode_ci |
21| collation_server | utf8mb4_unicode_ci |
22+----------------------+--------------------+
233 rows in set (0.00 sec)