[root@localhost~]# innobackupex --user=root --password=123456 /root/
InnoDBBackup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
andPercona LLC and/or its affiliates 2009-2013. All Rights Reserved.
Thissoftware is published under
the GNUGENERAL PUBLIC LICENSE Version 2, June 1991.
Get thelatest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p
15071414:53:44 innobackupex: Executing aversion check against the server...
15071414:53:44 innobackupex: Connecting toMySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as'root' (using password: YES).
innobackupex:got a fatal error with the following stacktrace: at /usr/bin/innobackupex line3011
main::mysql_connect('abort_on_error',1) called at /usr/bin/innobackupex line 1551
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
15071414:53:44 innobackupex: Connecting toMySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as'root' (using password: YES).
innobackupex:got a fatal error with the following stacktrace: at /usr/bin/innobackupex line3011
main::mysql_connect('abort_on_error',1) called at /usr/bin/innobackupex line 1570
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
[root@localhost~]# innobackupex --user=root --password='123456' /root/backup123
InnoDBBackup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
andPercona LLC and/or its affiliates 2009-2013. All Rights Reserved.
Thissoftware is published under
the GNUGENERAL PUBLIC LICENSE Version 2, June 1991.
Get thelatest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p
15071414:54:25 innobackupex: Executing aversion check against the server...
15071414:54:25 innobackupex: Connecting toMySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as'root' (using password: YES).
innobackupex:got a fatal error with the following stacktrace: at /usr/bin/innobackupex line3011
main::mysql_connect('abort_on_error',1) called at /usr/bin/innobackupex line 1551
innobackupex:Error: Failed to connect to MySQL server: DBIconnect(';mysql_read_default_group=xtrabackup','root',...) failed: Can'tconnect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at/usr/bin/innobackupex line 2995
15071414:54:25 innobackupex: Connecting toMySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as'root' (using password: YES).
innobackupex:got a fatal error with the following stacktrace: at /usr/bin/innobackupex line3011
main::mysql_connect('abort_on_error', 1)called at /usr/bin/innobackupex line 1570
innobackupex:Error: Failed to connect to MySQL server: DBIconnect(';mysql_read_default_group=xtrabackup','root',...) failed: Can'tconnect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at/usr/bin/innobackupex line 2995
解决方法:
看到此报错,我首先检查/var/lib/mysql下有没有mysql.sock这个文件,后来发现这个文件存储在我的tmp下。所以用--socket参数来解决此问题
[root@localhost~]# innobackupex --user=root --password='123456' --socket=/tmp/mysql.sock/root/
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
150714 15:17:32 innobackupex: Executing a version check against the server...
150714 15:17:32 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/tmp/mysql.sock' as 'root' (using password: YES).
150714 15:17:32 innobackupex: Connected to MySQL server
150714 15:17:32 innobackupex: Done.
150714 15:17:32 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/tmp/mysql.sock' as 'root' (using password: YES).
150714 15:17:32 innobackupex: Connected to MySQL server
150714 15:17:32 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!".
innobackupex: Using server version 5.6.12-log
innobackupex: Created backup directory /root/2015-07-14_15-17-32
150714 15:17:32 innobackupex: Starting ibbackup with command: xtrabackup --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/root/2015-07-14_15-17-32 --datadir="/usr/local/mysql/data/" --innodb_log_file_size="50331648" --innodb_data_file_path="ibdata1:12M:autoextend" --tmpdir=/tmp --extra-lsndir='/tmp'
innobackupex: Waiting for ibbackup (pid=12752) to suspend
innobackupex: Suspend file '/root/2015-07-14_15-17-32/xtrabackup_suspended_2'
xtrabackup version 2.2.11 based on MySQL server 5.6.24 Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /usr/local/mysql/data/
xtrabackup: open files limit requested 0, set to 1024
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
>> log scanned up to (2805576)
xtrabackup: Generating a list of tablespaces
[01] Copying ./ibdata1 to /root/2015-07-14_15-17-32/ibdata1
>> log scanned up to (2805576)
[01] ...done
[01] Copying ./tiankedb/tianke.ibd to /root/2015-07-14_15-17-32/tiankedb/tianke.ibd
[01] ...done
[01] Copying ./jiaowu/scores.ibd to /root/2015-07-14_15-17-32/jiaowu/scores.ibd
[01] ...done
[01] Copying ./jiaowu/sutdents2.ibd to /root/2015-07-14_15-17-32/jiaowu/sutdents2.ibd
[01] ...done
[01] Copying ./jiaowu/totor.ibd to /root/2015-07-14_15-17-32/jiaowu/totor.ibd
[01] ...done
[01] Copying ./jiaowu/students1.ibd to /root/2015-07-14_15-17-32/jiaowu/students1.ibd
[01] ...done
[01] Copying ./jiaowu/students.ibd to /root/2015-07-14_15-17-32/jiaowu/students.ibd
[01] ...done
[01] Copying ./jiaowu/tutors1.ibd to /root/2015-07-14_15-17-32/jiaowu/tutors1.ibd
[01] ...done
[01] Copying ./jiaowu/tutors.ibd to /root/2015-07-14_15-17-32/jiaowu/tutors.ibd
[01] ...done
[01] Copying ./jiaowu/sct2.ibd to /root/2015-07-14_15-17-32/jiaowu/sct2.ibd
[01] ...done
[01] Copying ./jiaowu/courses.ibd to /root/2015-07-14_15-17-32/jiaowu/courses.ibd
[01] ...done
[01] Copying ./mysql/test.ibd to /root/2015-07-14_15-17-32/mysql/test.ibd
[01] ...done
[01] Copying ./mysql/innodb_index_stats.ibd to /root/2015-07-14_15-17-32/mysql/innodb_index_stats.ibd
[01] ...done
[01] Copying ./mysql/slave_master_info.ibd to /root/2015-07-14_15-17-32/mysql/slave_master_info.ibd
[01] ...done
[01] Copying ./mysql/student.ibd to /root/2015-07-14_15-17-32/mysql/student.ibd
[01] ...done
[01] Copying ./mysql/innodb_table_stats.ibd to /root/2015-07-14_15-17-32/mysql/innodb_table_stats.ibd
[01] ...done
[01] Copying ./mysql/slave_relay_log_info.ibd to /root/2015-07-14_15-17-32/mysql/slave_relay_log_info.ibd
[01] ...done
[01] Copying ./mysql/testcourses.ibd to /root/2015-07-14_15-17-32/mysql/testcourses.ibd
[01] ...done
[01] Copying ./mysql/slave_worker_info.ibd to /root/2015-07-14_15-17-32/mysql/slave_worker_info.ibd
[01] ...done
[01] Copying ./mysql/courses.ibd to /root/2015-07-14_15-17-32/mysql/courses.ibd
[01] ...done
>> log scanned up to (2805576)
xtrabackup: Creating suspend file '/root/2015-07-14_15-17-32/xtrabackup_suspended_2' with pid '12752'
150714 15:17:35 innobackupex: Continuing after ibbackup has suspended
150714 15:17:35 innobackupex: Executing FLUSH TABLES...
150714 15:17:35 innobackupex: Executing FLUSH TABLES WITH READ LOCK...
150714 15:17:35 innobackupex: All tables locked and flushed to disk
150714 15:17:35 innobackupex: Starting to backup non-InnoDB tables and files
innobackupex: in subdirectories of '/usr/local/mysql/data/'
innobackupex: Backing up file '/usr/local/mysql/data//@0024database2/db.opt'
innobackupex: Backing up file '/usr/local/mysql/data//test/db.opt'
innobackupex: Backing up file '/usr/local/mysql/data//tiankedb/db.opt'
innobackupex: Backing up file '/usr/local/mysql/data//tiankedb/tianke.frm'
innobackupex: Backing up files '/usr/local/mysql/data//jiaowu/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (12 files)
>> log scanned up to (2805576)
innobackupex: Backing up file '/usr/local/mysql/data//@0024database1/db.opt'
innobackupex: Backing up files '/usr/local/mysql/data//mysql/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (81 files)
innobackupex: Backing up file '/usr/local/mysql/data//edb/db.opt'
innobackupex: Backing up files '/usr/local/mysql/data//performance_schema/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (53 files)
innobackupex: Backing up file '/usr/local/mysql/data//students/db.opt'
150714 15:17:37 innobackupex: Finished backing up non-InnoDB tables and files
150714 15:17:37 innobackupex: Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
150714 15:17:37 innobackupex: Waiting for log copying to finish
xtrabackup: The latest check point (for incremental): '2805576'
xtrabackup: Stopping log copying thread.
.>> log scanned up to (2805576)
xtrabackup: Creating suspend file '/root/2015-07-14_15-17-32/xtrabackup_log_copied' with pid '12752'
xtrabackup: Transaction log of lsn (2805576) to (2805576) was copied.
150714 15:17:38 innobackupex: All tables unlocked
innobackupex: Backup created in directory '/root/2015-07-14_15-17-32'
innobackupex: MySQL binlog position: filename 'mysql.000018', position 611374
150714 15:17:38 innobackupex: Connection to database server closed
150714 15:17:38 innobackupex: completed OK!