mysql 备份错误如下
[root@zw-test-db ~]# innobackupex --user=root --password=123456 --defaults-file=/etc/my.cnf --database=test /backup
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.
160812 11:36:18 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/etc/my.cnf;mysql_read_default_group=xtrabackup' as 'root' (using password: YES).
ERROR: Failed to connect to MySQL server: DBI connect(';mysql_read_default_file=/etc/my.cnf;mysql_read_default_group=xtrabackup','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/local/mysql/bin/innobackupex line 1384
innobackupex是通过socket的方式链接上去的。让它不走socket就可以了。
解决办法: innobackupex -host=192.168.26.233 --user=root --password=123456 --defaults-file=/etc/my.cnf --database=test /backup
加一个 -host 就ok了