The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

The MySQL server is currently offline

Discussion in 'Database Discussions' started by Ahmed Ezat, Jun 30, 2015.

  1. Ahmed Ezat

    Ahmed Ezat Registered

    Joined:
    Jun 30, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Egypt
    cPanel Access Level:
    Root Administrator
    I'm facing a problem with Green Geeks VPS my websites are going down almost five time a day due to MySQL server is offline and error establishing a database connection.

    It gives me this error :-

    Error while connecting to MySQL: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Error while connecting to MySQL: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at /usr/local/cpanel/Cpanel/Mysql.pm line 164.

    I talked with support many times but I didn't get any solution after all and it keep on happening does anyone know how to solve this problem ?
     
  2. DonaldBennett

    DonaldBennett Registered

    Joined:
    Jul 4, 2015
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Tampa, FL
    cPanel Access Level:
    DataCenter Provider
    Hello,

    You can run the following to create a symlink from /var/lib/mysql/mysql.sock to /tmp/mysql.sock

    ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock in SSH will do the trick

    Also you could add the following to /etc/my.cnf:

    [client]
    socket=/var/lib/mysql/mysql.sock

    Try it out and let me know.

    Thank You.

    EDIT: Removed incorrect syntax around /var/lib/mysql/mysql.sock
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page