/backup> innobackupex --defaults-file=/etc/my.cnf --user=root --password='xxxxx' /backup/20170803
170421 18:15:39 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!".
170421 18:15:39 version_check Connecting to MySQL server with DSN 'dbi:MysqL:;MysqL_read_default_group=xtrabackup' as 'root' (using password: YES).
170421 18:15:39 version_check Connected to MysqL server
170421 18:15:39 version_check Executing a version check against the server...
170421 18:15:39 version_check Done.
170421 18:15:39 Connecting to MysqL server host: localhost, user: root, password: set, port: 0, socket: (null)
Failed to connect to MysqL server: Can't connect to local MysqL server through socket '/tmp/MysqL.sock' (2).
仔细检查,发现输入的用户名和密码都是正确的,而且可以正常连接到数据库
/backup/MysqL_Backup/bin> MysqL -uroot -p
Enter password:
Welcome to the MysqL monitor. Commands end with ; or \g.
Your MysqL connection id is 12
Server version: 5.6.21-70.1-log Percona Server (GPL), Release 70.1, Revision 698
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MysqL>
报错原因:
在配置文件中没有配置socket
Xtrabackup在备份时,会使用本地的socket连接到数据库
解决方法:
在配置文件中增加socket选项
[root@localhost bin]# cat /etc/my.cnf
[MysqLd]
basedir = /usr
datadir = /var/lib/MysqL
log-error = /var/lib/MysqL/localhost.localdomain.err
pid-file = /var/lib/MysqL/localhost.localdomain.pid
#port = 3306
socket = /var/lib/MysqL/MysqL.sock
之后重启数据库,可以正常备份
/backup> innobackupex --defaults-file=/etc/my.cnf --user=backup --password='backup' /backup/20170803
170421 18:34:54 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!".
170421 18:34:54 version_check Connecting to MysqL server with DSN 'dbi:MysqL:;MysqL_read_default_group=xtrabackup;MysqL_socket=/var/lib/MysqL/MysqL.sock' as 'backup' (using password: YES).
170421 18:34:54 version_check Connected to MysqL server
170421 18:34:54 version_check Executing a version check against the server...
170421 18:34:54 version_check Done.
170421 18:34:54 Connecting to MysqL server host: localhost, user: backup, password: set, port: 0, socket: /var/lib/MysqL/MysqL.sock
Using server version 5.6.21-70.1-log
innobackupex version 2.4.4 based on MysqL server 5.7.13 Linux (x86_64) (revision id: df58cf2)
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /var/lib/MysqL
xtrabackup: open files limit requested 0, set to 32768
xtrabackup: using the following InnoDB configuration:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 50331648
InnoDB: Number of pools: 1
170421 18:34:54 >> log scanned up to (201239294)
xtrabackup: Generating a list of tablespaces
InnoDB: Allocated tablespace ID 45 for dmcdbTEST/com_numbering_plan, old maximum was 0
170421 18:34:55 >> log scanned up to (201239294)
170421 18:34:55 [01] copying ./ibdata1 to /backup/20170803/2017-04-21_18-34-54/ibdata1
170421 18:34:56 >> log scanned up to (201239294)
170421 18:34:57 >> log scanned up to (201239294)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。