I solved the problem with his method, the pro-test is available, do not use Navicat for MySQL to query the code,
Enter MySQL in the server with the root command and show variables like ' char% '; the encoding of the command query is the most accurate.
㈠ Preface
In order to deal with the opportunities and challenges of wireless Internet, avoid the problems caused by emoji emoticons,
The UTF8MB4 character set is recommended in advance for MySQL database recommendations involving wireless related
This has to be the key to a technology selection of the mobile internet industry
㈡ restrictions
Requires >= MySQL 5.5.3 version, from the library must be 5.5, the lower version does not support this character set, copy error
㈢ Brief steps
The following is a configuration step that is not upgraded to 5.5.3:
① backing up the database
② upgrading MySQL Server to v5.5.3+
③ Modifying the database, table, and column character sets
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 CHA NGE 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 was just an example for a ' VARCHAR ' column.)
④ modifying MY.CNF
[Client]
Default-character-set = Utf8mb4
[MySQL]
Default-character-set = Utf8mb4
[Mysqld]
Character-set-client-handshake = FALSE
Character-set-server = Utf8mb4
Collation-server = Utf8mb4_unicode_ci
init_connect= ' SET NAMES utf8mb4 '
⑤ restarting MySQL Server, checking the character set
mysql> SHOW VARIABLES WHERE variable_name like ' character\_set\_% ' OR variable_name like ' collation% ';
+--------------------------+--------------------+
| variable_name | Value |
+--------------------------+--------------------+
| character_set_client | UTF8MB4 |
| character_set_connection | UTF8MB4 |
| Character_set_database | UTF8MB4 |
| Character_set_filesystem | binary |
| Character_set_results | UTF8MB4 |
| Character_set_server | UTF8MB4 |
| Character_set_system | UTF8 |
| collation_connection | Utf8mb4_unicode_ci |
| Collation_database | Utf8mb4_unicode_ci |
| Collation_server | Utf8mb4_unicode_ci |
+--------------------------+--------------------+
Rows in Set (0.00 sec)
Http://www.linuxidc.com/Linux/2013-05/84360.htm
MySQL UTF8MB4 Character set: Support emoji emoji