innobackupex 备份时utf8mb4编码的mysql数据库失败

现象:

备份时出现如下错误:

[root@UHDEV014 wxc]# innobackupex --defaults-file=/etc/my_new.cnf --user=root --password=xxxxx--port=3307 --slave-info --safe-slave-backup --socket=/export/mysql_new/sock/mysql.sock --no-timestamp /apps/wxc/back3307
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013.  All Rights Reserved.
This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p

170113 14:24:58  innobackupex: Executing a version check against the server...
170113 14:24:58  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/etc/my_new.cnf;mysql_read_default_group=xtrabackup;port=3307;mysql_socket=/export/mysql_new/sock/mysql.sock' as 'root'  (using password: YES).
Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
innobackupex: got a fatal error with the following stacktrace: at /usr/bin/innobackupex line 3011
        main::mysql_connect('abort_on_error', 1) called at /usr/bin/innobackupex line 1551
innobackupex: Error: Failed to connect to MySQL server: DBI connect(';mysql_read_default_file=/etc/my_new.cnf;mysql_read_default_group=xtrabackup;port=3307;mysql_socket=/export/mysql_new/sock/mysql.sock','root',...) failed: Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/) at /usr/bin/innobackupex line 2995
170113 14:24:58  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/etc/my_new.cnf;mysql_read_default_group=xtrabackup;port=3307;mysql_socket=/export/mysql_new/sock/mysql.sock' as 'root'  (using password: YES).
Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
innobackupex: got a fatal error with the following stacktrace: at /usr/bin/innobackupex line 3011
        main::mysql_connect('abort_on_error', 1) called at /usr/bin/innobackupex line 1570
innobackupex: Error: Failed to connect to MySQL server: DBI connect(';mysql_read_default_file=/etc/my_new.cnf;mysql_read_default_group=xtrabackup;port=3307;mysql_socket=/export/mysql_new/sock/mysql.sock','root',...) failed: Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/) at /usr/bin/innobackupex line 2995


原因:

innobackupex连接数据库时,默认的字符集为utf8,但是my_new.cnf


解决方法:修改/etc/my_new.cnf文件中的如下内容:

[client]
default-character-set=utf8

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值