XtraBackup Can't connect to local MySQL server through socket '/tmp/mysql. sock ',

Source: Internet
Author: User

XtraBackup Can't connect to local MySQL server through socket '/tmp/mysql. sock ',

 

When Xtrabackup is used for backup, the following error message is displayed: MySQL server: Can't connect to local MySQL server through socket '/tmp/mysql. so' (2)

 
[root@MySQL-DB ~]# innobackupex --defaults-file=/usr/my.cnf --user=root --password=password  /mnt/resource/mysql_backup
160322 22:28:43 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!".
 
160322 22:28:43  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root'  (using password: YES).
Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1327.
160322 22:28:43 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).

This error occurs because I modified the datadir parameter in my. cnf but did not modify the socket parameter (the parameter is blank. In addition, it is estimated that this error will also occur if the correct configuration is not found after I change the MySQL DATA DIRECTORY. first, find the corresponding mysql. sock file location, and then modify my. the scoket value in cnf can be solved by restarting the MySQL service.

[root@MySQL-DB mysql_backup]# find / -name "mysql.sock"
 
/var/lib/mysql/mysql.sock

In addition, in this article, ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql. the establishment of soft connections described in sock '(2) can also solve this problem.

In addition, there are some remedies on the Internet to solve this problem, that is, specifying -- host = 127.0.0.1 can also avoid this error, and I can test to solve the problem. However, this is a temporary solution.

innobackupex --defaults-file=/usr/my.cnf --user=root --password=password --host=127.0.0.1 /mnt/resource/mysql_backup

References:

Http://www.cnblogs.com/fuhj02/p/3541173.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.