Closed leoliuxd closed 7 years ago
Here are mysql charset:(use client Navicat connected to mysql ) character_set_client utf8 character_set_connection utf8 character_set_database gbk character_set_filesystem binary character_set_results utf8 character_set_server utf8 character_set_system utf8 character_sets_dir
This occurs to a table, which has such structure:
CREATE TABLE pre_common_syscache
(
cname
varchar(64) NOT NULL DEFAULT '',
ctype
tinyint(3) unsigned NOT NULL,
dateline
int(10) unsigned NOT NULL,
data
mediumblob NOT NULL,
PRIMARY KEY (cname
),
KEY cname
(cname
),
KEY dateline
(dateline
),
KEY ctype
(ctype
)
) ENGINE=InnoDB DEFAULT CHARSET=gbk ROW_FORMAT=DYNAMIC COMMENT=''
data
mediumblob maybe this is the problem
can you send my your my.cnf ?
binary log are in binary so I think charset at this point should be not a problem.
SET NAMES 'gbk';
insert into pre_common_syscache (cname, ctype, dateline, data) values ('丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱', '1', '3', '丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱');
=== Event query ===
Date: 2017-08-25T12:45:19+00:00
Log position: 3888
Event size: 260
Database: test1
Execution time: 0
Query: insert into pre_common_syscache (cname, ctype, dateline, data) values ('丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱', '1', '3', '丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱')
Memory usage 2.52 MB
Ok, there's codec error when write db. I will do more test. Thanks ~~
I have set GBK,
............. ->withCharset('gbk') ->build() );
but error still came out at [ErrorException] unpack(): Type I: not enough input, need 4, have 0
but when use utf8 it's [ErrorException] unpack(): Type i: not enough input, need 4, have 3
php 5.6 , centos 7 64bit mysql 5.6.16