let MySQL support emoji emoticons, involving wireless-related MySQL database recommendations are in advance with the UTF8MB4 character set.
MySQL version 5.6
1 solution: Convert the MySQL encoding from UTF8 to UTF8MB4.
Requires >= MySQL 5.5.3 version, from the library must be 5.5, the lower version does not support this character set, copy error
2 my.cnf File added
[Mysqld]
character-set-server = Utf8mb4
collation-server = Utf8mb4_unicode_ci
init_connect= ' SET NAMES utf8mb4 '
3 Modifying the character set to add a library table field
To modify the database character set:
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
To modify the character set of a table:
ALTER TABLE table_name CONVERT to CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
To modify the character set of a field:
ALTER TABLE table_name Change column_name column_name VARCHAR (191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
If it's just a field, you just need to modify that field's character set.
4 If you do not modify the above, please query SQL
Mysql> Show variables like '%sql_mode% ';
+---------------+--------------------------------------------+
| variable_name | Value |
+---------------+--------------------------------------------+
| Sql_mode | strict_trans_tables,no_engine_substitution |
+---------------+--------------------------------------------+
1 row in Set (0.00 sec)
If that's the result, congratulations, you can't store it.
Go to set this sql_mod mode (note that the changes here to see after you exit the console or not see the effect, and
And this configuration write my.cnf Restart the server is not effective, if you want to ask why please go to the MySQL consulting Group)
mysql> Set Global Sql_mode = ' no_engine_substitution ';
Mysql> Show variables like '%sql_mode% ';
+---------------+------------------------+
| variable_name | Value |
+---------------+------------------------+
| Sql_mode | no_engine_substitution |
+---------------+------------------------+
1 row in Set (0.00 sec)
6 done with this, let MySQL support emoji expression
This article is from the "believe it or not you" blog, please be sure to keep this source http://312461613.blog.51cto.com/965442/1718999
Let MySQL support emoji emoticons MySQL 5.6