innobackupex: Error: Failed to connect to MySQL server as DBD::mysql module is not installed

   innobackupex同时支持备份innodb和MyISAM(会加一个全局的读锁)。

[mysql@gdsDB bin]$ ./innobackupex --user=root --password= --socket=/oradata/MC/mysqldata/3308/mysql.sock --defaults-file=/oradata/MC/mysqldata/3308/my.cnf /oradata/MC/mysqldata/backup --no-timestamp

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

170323 09:00:05  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/oradata/MC/mysqldata/3308/my.cnf;mysql_read_default_group=xtrabackup;mysql_socket=/oradata/MC/mysqldata/3308/mysql.sock' as 'root'  (using password: NO).
innobackupex: Error: Failed to connect to MySQL server as DBD::mysql module is not installed at ./innobackupex line 2976.
[mysql@gdsDB bin]$ ./innobackupex --user=root --password= --socket=/oradata/MC/mysqldata/3308/mysql.sock --defaults-file=/oradata/MC/mysqldata/3308/my.cnf /oradata/MC/mysqldata/backup --no-timestamp

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

170323 09:00:45  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/oradata/MC/mysqldata/3308/my.cnf;mysql_read_default_group=xtrabackup;mysql_socket=/oradata/MC/mysqldata/3308/mysql.sock' as 'root'  (using password: NO).
innobackupex: Error: Failed to connect to MySQL server as DBD::mysql module is not installed at ./innobackupex line 2976.

根据操作系统的版本安装合适的perl-DBD-MySQL,因为innobackupex是一个封装了xtrabackup的perl脚本。
[root@gdsDB MC]# rpm -ivh perl-DBD-MySQL-4.013-3.el6.x86_64.rpm 
warning: perl-DBD-MySQL-4.013-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:perl-DBD-MySQL         ########################################### [100%]
   
[mysql@gdsDB bin]$ ./innobackupex --user=root --password= --socket=/oradata/MC/mysqldata/3308/mysql.sock --defaults-file=/oradata/MC/mysqldata/3308/my.cnf /oradata/MC/mysqldata/backup --no-timestamp
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

170323 09:07:26  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/oradata/MC/mysqldata/3308/my.cnf;mysql_read_default_group=xtrabackup;mysql_socket=/oradata/MC/mysqldata/3308/mysql.sock' as 'root'  (using password: NO).
170323 09:07:26  innobackupex: Connected to MySQL server
170323 09:07:26  innobackupex: Executing a version check against the server...
170323 09:07:26  innobackupex: Done.
IMPORTANT: Please check that the backup run completes successfully.
           At the end of a successful backup run innobackupex
           prints "completed OK!".
innobackupex: Using mysql server version 5.6.25-log
sh: xtrabackup_56: command not found

innobackupex: Error: no 'mysqld' group in MySQL options at ./innobackupex line 4377.

把环境变量加上去即可

[mysql@gdsDB bin]$ export PATH=/oradata/MC/mysqldata/percona-xtrabackup-2.1.7-Linux-x86_64/bin:$PATH

再次执行命令成功

你可能感兴趣的:(mysql)