您的位置:首页 > 数据库 > MySQL

mysql 保存表情符号

2015-08-01 10:37 141 查看
jdbc:mysql://test.dbhost.cn:606/db?allowMultiQueries=true&useUnicode=true&characterEncoding=utf8

将\MySQL\MySQL Server 5.5\my.ini里面的 character-set=utf8 替换为 character-set=utf8mb4

SHOW VARIABLES LIKE '%CHARACTER%';

SHOW GLOBAL VARIABLES LIKE '%CHARACTER%';

ALTER TABLE T_User MODIFY COLUMN NickName VARCHAR(100)

CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '昵称';

CREATE DEFINER=`CN80s.ASSN`@`%` PROCEDURE `test_pppp`(

pCommentGuid VARCHAR(36) CHARSET utf8mb4 COLLATE utf8mb4_bin,

pInt INT

)

BEGIN

SELECT pCommentGuid,pInt;

END$$

DELIMITER ;

CREATE TABLE `TableName1` (

`aa` VARCHAR(222) CHARACTER SET utf8mb4 NOT NULL,

`bb` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL

) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC

表的字段和存储过程字段对应的参数应设置编码为utf8mb4

SET GLOBAL character_set_client=utf8mb4;

SET GLOBAL character_set_connection=utf8mb4;

SET GLOBAL character_set_results=utf8mb4;

SET GLOBAL character_set_database=utf8mb4;

SET GLOBAL character_set_server=utf8mb4;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: