Error while connecting to MYSQL - Cant connect to a local MySQL server through socket
A few weeks ago our sites example.com & domain.com ran into an issue regarding the MySql databases. My only solution to fix them was to delete the cpanel sites and restore the sites back to a time when they worked. I thought it had solved the issue, however after a few days of running normally they have both ran in the following errors in MySql:
I have tried rebooting the server but that didn't work either. I will delete the cpanel site of example.com but domain will remain incase anyone wanted to see how it currently sits. It's a weird issue and one I can't figure out so thanks in advance.
The system will redirect you in amoment. Error while connecting to MYSQL: (XID u878g3) Can"t connect to a local MySQL server through socket "/var/lib/mysql/mysql.cok" (2)Error while connecting to MySQL: (XID u878g3) Can"t connect to local MySQL server through socket "var/lib/mysql/mysql.sock" (2) at /usr/local/cpanel/Cpanel/Mysql.pm line 181.
I have tried rebooting the server but that didn't work either. I will delete the cpanel site of example.com but domain will remain incase anyone wanted to see how it currently sits. It's a weird issue and one I can't figure out so thanks in advance.
-
I don't think deleting and restoring is fixing, TBH. You might check to make sure MySQL is up and running. If it is and you can connect to your site(s) as expected, great. What's killing your mysql.sock? Sounds like that's whats happening. Guessing of course. Are you manually clearing tmp for some reason? 0 -
I don't think deleting and restoring is fixing, TBH. You might check to make sure MySQL is up and running. If it is and you can connect to your site(s) as expected, great. What's killing your mysql.sock? Sounds like that's whats happening. Guessing of course. Are you manually clearing tmp for some reason?
Ha Yeah, sorry it most definitely isn't a fix. But I though it was something I had done. I ha. It is now saying that MySQL is currently offline - however when I restart MySql the problem still remains. Apologies as I'm quite new to all of this so learning as I go.0 -
What message do you get when trying to restart MySQL exactly? 0 -
Hi thanks for replying: When restarting MySQL via WHM I get the following messages: Waiting for "mysql" to start ""waiting for "mysql" to initialize "finished. Startup Log Starting MySQL... SUCCESS! Log Messages 160612 4:42:50 [Note] /usr/sbin/mysqld: ready for connections. 160612 04:42:48 mysqld_safe mysqld restarted 160612 04:42:48 mysqld_safe Number of processes running now: 0 /usr/sbin/mysqld[0x84f4a2] /usr/sbin/mysqld[0x859dfa] /usr/sbin/mysqld[0x91d4a2] /usr/sbin/mysqld[0x928fd8] /usr/sbin/mysqld[0x928acf] /usr/sbin/mysqld[0x885508] /usr/sbin/mysqld[0x8d214b] /usr/sbin/mysqld[0x8d1c9a] 160612 4:42:48 [Note] /usr/sbin/mysqld: ready for connections. 160612 04:42:45 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 160611 08:02:39 mysqld_safe mysqld from pid file /var/lib/mysql/s45-40-136-69.secureserver.net.pid ended /usr/sbin/mysqld[0x84f4a2] /usr/sbin/mysqld[0x859dfa] /usr/sbin/mysqld[0x91d4a2] /usr/sbin/mysqld[0x928fd8] /usr/sbin/mysqld[0x928acf] /usr/sbin/mysqld[0x885508] /usr/sbin/mysqld[0x8d214b] /usr/sbin/mysqld[0x8d1c9a]
0 -
Hello :) Check whether OOM killer terminates the MySQL server. You can check it using the following command # egrep -i "oom|kill|mysql" /var/log/messages 0 -
Hello ssfred, Thank you for your respones. When I enter the suggested command I get the following: egrep: /var/log/messages: Permission denied Have logged into Putty correctly but recieve this message when attempting most commands. :S 0 -
You need to be doing that as root. If you don't have root access, then that's why you're not seeing permissions. 0 -
Oh duh - so I ran the command you suggested. I think most of it was killed but the last part was the following: Jun 14 05:29:17 s45-40-136-69 PAM-hulk[3752]: Brute force detection active: 400 Unable to connect to database backend: Failed to connect to mysql db: cphulkd: . Jun 14 05:29:27 s45-40-136-69 PAM-hulk[3806]: Brute force detection active: 400 Unable to connect to database backend: Failed to connect to mysql db: cphulkd: . So based on that I'd imagine it wasn't successful. 0 -
I have tried to locate Mysql files but it just states no such directory. When I try to start MySql I get "Starting MySql........................." without it ever processing. Weird that MySQL could have just vanished or moved. 0 -
Update: I thought I would try and reset MySql again to see how it reacts after the command. At least it now recognises theres an issue and it's not running. Service Error (XID yky6ct) The "mysql" service failed to start. Startup Log Starting MySQL..................................................................................................... ERROR! The server quit without updating PID file (/var/lib/mysql/s45-40-136-69.secureserver.net.pid). Log Messages 160614 06:18:36 mysqld_safe mysqld from pid file /var/lib/mysql/s45-40-136-69.secureserver.net.pid ended 2016-06-14 06:18:36 14882 [Note] /usr/sbin/mysqld: Shutdown complete 0 -
What errors (if any) are you seeing in your /var/lib/mysql/HOSTNAME.err file ? 0 -
Hi Rpww - I cant access the .err file. All I get is No such file or directory. When I searched to find all socket files - it would appear that my.sql.sock doesn't exist at all. :S [Have uploaded to show example] 0 -
Sorry yes, I had been doing so but just realised I was missing a dash. Aplogies that you have to put up with me ha [root@s45-40-136-69 ~]# /var/lib/mysql/s45-40-136-69.secureserver.net.err -bash: /var/lib/mysql/s45-40-136-69.secureserver.net.err: Text file busy 0 -
You will probably want to view the file using the # cat | less
command0 -
Ok great :) have done that. The results have been uploaded as a file. Thanks for that 0 -
After looking over this thread from your first report, and because we can see no obvious errors in the err file other than the fact that the mysqld didn't shut down cleanly the previous time, I am beginning to wonder if your problem is memory and/or file capacity (or rather, a lack of it ). Rolling back your sites and their databases might have just given you the additional room for the daemon to have worked briefly until more was written to the table, and possibly more files added to the site ? I think it might be useful for you to check that you have sufficient memory and/or space left on your system, especially on the /tmp folder or file system. Perhaps some sql guru can jump in here and see something that we have missed. Or even better, and probably considerably faster - open a support ticket with cPanel and let the experts take the strain o_O 0
Please sign in to leave a comment.
Comments
17 comments