[root@node1 mysql]# innobackupex --user=root --passwor=redhat /root/backup/
140619 18:20:08 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root' (using password: YES).
innobackupex: Error: Failed to connect to MySQL server: DBI connect(';mysql_read_default_group=xtrabackup','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/bin/innobackupex line 2995
innobackupex: Error: Failed to connect to MySQL server: DBI 这个问题安装下面红色部分即可解决。
connect(';mysql_read_default_group=xtrabackup','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/bin/innobackupex line 2995
说明没有读取到my.cnf中的socket路径,也说明备份连接数据库时候走的是socket接口形式,
我们可以换做走tcp/ip --host=127.0.0.1 即可、
innobackupex --user=root --defaults-file=/usr/local/mysql/my.cnf --host=127.0.0.1 /root/mysqlsoft/
我看网上说安装perl-DBD-MySQL,可以解决,
yum install perl-DBI
yum install perl-DBD-MySQL
yum install perl-Time-HiRes
yum install perl-IO-Socket-SSL
但是我安装过后,一样出现此问题。
PS:MySQL的版本是5.6.16, 二进制包安装,而且。 my.cnf中指定了 socket的路径(/tmp/mysql.socket)
本文转自crazy_charles 51CTO博客,原文链接:http://blog.51cto.com/douya/1592000,如需转载请自行联系原作者