#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    44
    Rep Power
    2

    Can't connect to local MySQL server / MySQL error log


    Hi all,

    My Debian VPS website has been fine for months and then today suddenly gave the error "can't connect to local MySQL server through socket /var/run/mysqld/mysqld.sock". I looked at the resources (RAM, hard disk, CPU, traffic) and there were plenty of resources to spare. It was ok again after I rebooted the VPS.

    Any ideas please how this might happen? Should I expect any clues from today's /var/log/mysql/mysql.log ? This is a very big file (110 MB / 650,000 lines) which I think is mostly today's MySQL queries but it does not seem to mention this error. Would MySQL errors usually be in this file or should there be a separate file for errors?

    Thank you...
  2. #2
  3. No Profile Picture
    Problem Solver
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2001
    Location
    Stockholm, Sweden
    Posts
    4,495
    Rep Power
    534
    That's the General Query Log which as you noticed contains all queries that has been issued against your server since the last log rotation.

    You should look for a file that's usually named something like mysql.err or yourHostName.err.

    Read here: http://dev.mysql.com/doc/refman/5.6/en/error-log.html


    Did you check if the socket was still at /var/run/mysqld/mysqld.sock _before_ you rebooted the server?

    My guess is that either your MySQL server has been restarted and you have conflicting configuration files.
    Or that your PHP (I'm guessing that's what you are using since you didn't mention anything about it) might have conflicting configurations or that the user that Apache runs as didn't have access to the socket, etc.

    Basically the only thing you can do is to troubleshoot it when the problem exists. The error logs and the syslog etc might tell you a piece of the story so yes go through those first.

    Good luck!
    /Stefan
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    44
    Rep Power
    2
    Originally Posted by sr
    That's the General Query Log which as you noticed contains all queries that has been issued against your server since the last log rotation.

    You should look for a file that's usually named something like mysql.err or yourHostName.err.

    Read here: http://dev.mysql.com/doc/refman/5.6/en/error-log.html


    Did you check if the socket was still at /var/run/mysqld/mysqld.sock _before_ you rebooted the server?

    My guess is that either your MySQL server has been restarted and you have conflicting configuration files.
    Or that your PHP (I'm guessing that's what you are using since you didn't mention anything about it) might have conflicting configurations or that the user that Apache runs as didn't have access to the socket, etc.

    Basically the only thing you can do is to troubleshoot it when the problem exists. The error logs and the syslog etc might tell you a piece of the story so yes go through those first.

    Good luck!
    @ sr thanks for your reply. It is Debian LAMP. It has run fine for months and I haven't done anything to cause a change. There is a mysql.err in /var/log but it is empty so not much help. Any suggestions please what I should do if it happens again?

    Thanks...

IMN logo majestic logo threadwatch logo seochat tools logo