登录
首页 >  数据库 >  MySQL

【xtrabackup故障】Failed to connect to MySQL to detect version

来源:SegmentFault

时间:2023-01-10 21:48:12 224浏览 收藏

本篇文章向大家介绍《【xtrabackup故障】Failed to connect to MySQL to detect version》,主要包括MySQL,具有一定的参考价值,需要的朋友可以参考一下。

今天在做数据库备份数据遇到一个问题,主要原因是:备份和恢复的时候使用的xtrabackup的版本不一致

问题

使用xtrabackup校验数据的时候报错:

# innobackupex --apply-log /data/back/  
  
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy  
and Percona Ireland Ltd 2009-2012.  All Rights Reserved.  
  
This software is published under  
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.  
  
141125 09:43:44  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'backupuser'  (using password: YES).  
Failed to connect to MySQL server to detect version.  
You must set xtrabackup version to use with --ibbackup option.  
Possible values are xtrabackup_55 (for MySQL 5.5), xtrabackup_56 (for MySQL or Percona Server 5.6, or xtrabackup (for MySQL 5.1 with InnoDB plugin or Percona Server)  

根据报错提示,失败查明mysql的版本,需要指明--ibbackup选项,因为我的mysql是5.6版本的,所以我使用--ibbackup xtrabackup_56,
之前的备份还原是不需要添加该参数的,很奇怪,检查发现是备份的xtrbackup不是我经常使用的2.4,而是2.1.9,所以还原上面有些出入

解决:

# innobackupex --use-memory=1G --apply-log /data/back --ibbackup xtrabackup_56  

................................................... 
InnoDB: 5.6.17 started; log sequence number 3974285875212
[notice (again)]
  If you use binary log and don't use any hack of group commit,
  the binary log position seems to be:
InnoDB: Last MySQL binlog file position 0 365497561, file name mysql-bin.003475

xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 3974285876610
171011 09:43:10  innobackupex: completed OK!

到这里,我们也就讲完了《【xtrabackup故障】Failed to connect to MySQL to detect version》的内容了。个人认为,基础知识的学习和巩固,是为了更好的将其运用到项目中,欢迎关注golang学习网公众号,带你了解更多关于mysql的知识点!

声明:本文转载于:SegmentFault 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>
评论列表