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.

Can't connect to local MySQL server through socket

Discussion in 'Database Discussions' started by elias9, Dec 18, 2014.

  1. elias9

    elias9 Member

    Joined:
    Oct 30, 2014
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    This problem is repeated every time

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

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Could you elaborate further on when you receive this message? For instance, is it happening with a PHP script? Is MySQL running on your system?

    Thank you.
     
  3. elias9

    elias9 Member

    Joined:
    Oct 30, 2014
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Error in cpanel is:

    Error while connecting to MySQL: Cpanel::DBI::Mysql connect('','root',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at /usr/local/cpanel/Cpanel/MysqlUtils/Connect.pm line 156. Error while connecting to MySQL: Cpanel::DBI::Mysql connect('','root',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at /usr/local/cpanel/Cpanel/MysqlUtils/Connect.pm line 156.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  5. elias9

    elias9 Member

    Joined:
    Oct 30, 2014
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Yes , but there is something unusual (High Load) I think Mysql is the reason.

    Service Status:
    mysqld_safe (/bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/myhost.pid) running as root with PID 15917 (process table check method)
    mysqld (/usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/myhost.err --open-files-limit=34104 --pid-file=/var/lib/mysql/myhost.pid) running as mysql with PID 16070 (pidfile check method)

    Startup Log:
    Starting MySQL..... SUCCESS!

    Log Messages:
    2014-12-28 03:44:01 16070 [Note] /usr/sbin/mysqld: ready for connections.
    141228 03:43:56 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    141228 03:43:55 mysqld_safe mysqld from pid file /var/lib/mysql/myhost.pid ended
    2014-12-28 03:43:55 24059 [Note] /usr/sbin/mysqld: Shutdown complete
    2014-12-28 03:43:52 24059 [Warning] /usr/sbin/mysqld: Forcing close of thread 12480 user: 'leechprotect'
    2014-12-28 03:43:52 24059 [Warning] /usr/sbin/mysqld: Forcing close of thread 12822 user: 'modsec'
    2014-12-28 03:43:50 24059 [Note] /usr/sbin/mysqld: Normal shutdown
    2014-12-27 19:48:17 24059 [Note] /usr/sbin/mysqld: ready for connections.
    141227 19:48:05 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

    mysql started successfully.
     
  6. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    569
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
Loading...

Share This Page