Not the answer you need?
Register and ask your own question!

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

i-CONICAi-CONICA EntrantInactive User Role Beginner
Hi,

I've got a problem.

I'm running Percona 5.5.35 on a LAMP stack.

The application can communicate with the database just fine, but when I try to run automysqlbackup I get the error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

That's the same socket path specified in my.cnf.

Any help is much appreciated.
Thanks.

Comments

  • jagatveerjagatveer Entrant Inactive User Role Beginner
    The error simply states that your MySQL is not available/running to accept any connection. Are you able to connect to MySQL via CLI when you get this error? What does the error logs say?
  • niljoshiniljoshi MySQL Sage Inactive User Role Beginner
    Hi,

    How you are running automysqlbackup? Is it possible for you to give socket details in that?
    Also as Jagatvir said, Is your MySQL running? In Linux, you can simply check with "ps -ef | grep mysql"
    I would also suggest to check that automysqlbackup is trying to connect to the same host which you are connecting through application.
  • mixamixa Member Inactive User Role Beginner
    As far as I could see:
    http://sourceforge.net/projects/automysqlbackup/

    It supports "socket" option.

    You can also check if the following exists in you mysql configuration (my.cnf) and if no then add it:

    [client]
    socket = /var/run/mysqld/mysqld.sock
  • umarzukiumarzuki Contributor Current User Role Beginner
    what if there is mysql.sock in path specified?
    $ sudo ls -l /var/lib/mysql/mysql.sock
    srwxrwxrwx 1 mysql mysql 0 Mei  22 15:42 /var/lib/mysql/mysql.sock
    
  • newman21newman21 Entrant Current User Role Beginner
    Hello everyone. I need help with xtra backup software because I can't create backup and error is similar to topicstarter's error.
    Command:
    innobackupex --user=root --password=paassss --no-timestamp /home/aaa/28.09.18
    
    show me an error
    180928 11:01:55  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: DBI connect(';mysql_read_default_group=xtrabackup','root',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at - line 1315.
    

    Next try was to specify socket location:
    innobackupex --user=root --password=paassss --socket=/var/lib/mysql/mysql.sock --no-timestamp /home/aaa/28.09.18
    
    Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: /var/lib/mysql/mysql.sock
    Error: Unsupported server version: '5.7.23-23-log'. Please report a bug at https://bugs.launchpad.net/percona-xtrabackup
    
    lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 18.04.1 LTS
    Release:        18.04
    Codename:       bionic
    
    apt-cache policy percona-xtrabackup
    percona-xtrabackup:
      Installed: 1:2.3.10-1.bionic
      Candidate: 1:2.3.10-1.bionic
      Version table:
     *** 1:2.3.10-1.bionic 500
            500 http://repo.percona.com/apt bionic/main amd64 Packages
            100 /var/lib/dpkg/status
         2.4.9-0ubuntu2 500
            500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
    
    
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.