Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Xtrabackup backup error Failed to connect to MySQL server

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Xtrabackup backup error

/ 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).

After careful inspection, it is found that the user name and password entered are correct and can connect to the database normally.

/ 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 >

Reason for reporting an error:

Socket is not configured in the configuration file

When Xtrabackup backs up, it uses the local socket to connect to the database

Solution:

Add the socket option to the configuration file

[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

After that, restart the database and back up normally.

/ 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 January 18-34-54/ibdata1

170421 18:34:56 > > log scanned up to (201239294)

170421 18:34:57 > > log scanned up to (201239294)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report