Home > Database > Mysql Tutorial > body text

Character set '#45' 导致主从停止问题

WBOY
Release: 2016-06-07 17:58:58
Original
1523 people have browsed it

今天有同学在搭建主从环境的时候发现一个问题,简单说明一下。感谢 @年代80s. 现象: 从库上Slave_IO_Running停止,Last_Error显示如下: bin/mysqlbinlog: Character set #45 is not a compiled character set and is not specified in the /u01/dingqi.lxb/

今天有同学在搭建主从环境的时候发现一个问题,简单说明一下。感谢 @年代80s.

现象:

从库上Slave_IO_Running停止,Last_Error显示如下:

bin/mysqlbinlog: Character set ‘#45′ is not a compiled character set and is not specified in the ‘/u01/dingqi.lxb/transfer2/master/share/mysql/charsets/Index.xml’ file
-


分析:

此时用mysqlbinlog 执行对应的relaylog文件,也会出现上面这个错误提示。

查看这个提示位置的Index.xml,这里记录了这个server提供的所有字符集。我们发现,其实没有id为45的字符集。

也就是这个原因,导致slave在同步时,解析出错,导致同步停止。

SET @@session.character_set_client=45,@@session.collation_connection=45,@@session.collation_server=33

从这个命令中看,是有用户连接进master以后,执行了一个set names xxx (xxx是某个字符集名字),而这个xxx被翻译成45.



复现:

我们要找出编号45的字符集。在5.5上执行如下命令:

发现原来是这个叫做utf8mb4的字符集,这个字符集在5.1里面是还没有的。

解决:

给我们的提示就是在高版本对低版本的主从中,要注意不要用到低版本不支持的字符集(所以官方并不建议高版本的master同步到低版本的slave)。

对于已经在Master的里面已经存在的binlog,要让主从能够继续同步,只能在slave_skip_errors里加上 22这个错误号.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!