Skip to main content

Can't connect to local MySQL server through socket

Comments

5 comments

  • cPanelMichael
    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.
    0
  • elias9
    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.
    0
  • cPanelMichael
    Could you check to see if the /tmp/mysql.sock link exists on your system? Thank you.
    0
  • elias9
    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.
    0
  • cPanelPeter cPanel Staff
    Hello, You may want to consider reviewing this Troubleshooting High Server Loads then.
    0

Please sign in to leave a comment.