Convert Mysql encoding from utf8 to utf8mb4.
Requires >= MySQL version 5.5.3, (checked 5.5.29 is also possible) lower version does not support this character set, copy error
Stop MySQL Server service
Modify my.cnf or mysql.ini
[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'
Restart MySQL Server: service mysql restart, check the character set
SHOW VARIABLES WHERE Variable_name LIKE 'character%' OR Variable_name LIKE 'collation%';
Modify the database character set:
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
Modify the character set of the table:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Modify the character set of the field:
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Use mysql-connector-java-5.1.18.jar or higher in the program
Database connection use ?useUnicode=true
jdbc:mysql://127.0.0.1:3306/o2o_user_suda?useUnicode=true
########################################
ALTER DATABASE `o2o_user_onetime` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE order_info CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
SHOW VARIABLES WHERE Variable_name LIKE 'character%' OR Variable_name LIKE 'collation%';
SET character_set_client = utf8mb4 ;
SET character_set_connection = utf8mb4 ;
SET character_set_results = utf8mb4 ;
SET character_set_server = utf8mb4 ;