今天为公司新建的 uat 数据库使用 XtraBackup 备份时,出现了报错,将解决方法整理,做一下备忘:
服务器系统:
mysql 版本号:
[root@uat - mysql - master tmp]# cat / etc / RedHat - release
CentOSLinux release 7.3.1611 (Core)
报错如下:
mysql>select version();
+----------------+
| version() |
+----------------+
| 5.5.47 - cll - lve |
+----------------+
1 row inset(0.00 sec)
解决办法:
[root@uat - mysql - master tmp]# innobackupex
--defaults - file = /etc/my.cnf --user = backup --password = ******--stream = tar / home / backup / | gzip > /home/backup / `date + %F_ % H - %M - %S`.tar.gz
17112017 : 10 : 42 innobackupex: Starting the backup operation
IMPORTANT: Please
check
that the backup run completes successfully.
At the end of
a successful backup run innobackupex
prints "completed OK!".
17112017 : 10 : 42 version_check Connecting
to MySQL server with DSN
'dbi:mysql:;mysql_read_default_group=xtrabackup'
as'backup' (using password: YES).
Failed to connect to
MySQL server: DBI
connect(
';mysql_read_default_group=xtrabackup'
,'backup',...) failed:Can
't connect to local MySQL server through socket '
/var/lib / mysql / mysql.sock
' (2) at - line 1314.'
17112017:10:42Connecting to MySQL server host: localhost, user: backup, password:set, port:notset, socket:notset
Failed to connect to MySQL server: Can ''
t connect to local
MySQL server through socket
'/var/lib/mysql/mysql.sock'
(2).
在命令行中添加
--host=127.0.0.1
参数;
备注:网上有的说,通过
# find / - name "mysql.sock"
查到 socket 参数,然后在配置文件中修改,但测试后,不一定能解决问题.
更多 XtraBackup 相关教程见以下内容:
使用 Xtrabackup 进行 MySQL 备份 http://www.linuxidc.com/Linux/2016-11/137734.htm
Percona Xtrabackup 安装 http://www.linuxidc.com/Linux/2016-11/137735.htm
Percona XtraBackup 安装介绍篇 http://www.linuxidc.com/Linux/2017-07/145638.htm
使用 XtraBackup 备份 MySQL 数据库 http://www.linuxidc.com/Linux/2016-12/138688.htm
使用 Xtrabackup 进行 MySQL 数据库全备和全备还原 http://www.linuxidc.com/Linux/2016-11/137736.htm
XtraBackup 备份原理和实战详解 http://www.linuxidc.com/Linux/2017-04/142477.htm
Percona XtraBackup 实现全备 & 增量备份与恢复 http://www.linuxidc.com/Linux/2017-03/142380.htm
XtraBackup 备份原理和实战详解 http://www.linuxidc.com/Linux/2017-04/142477.htm
来源: http://www.linuxidc.com/Linux/2018-01/150124.htm