Skip to main content

Error while connecting to MYSQL - Can’t connect to a local MySQL server through socket

Comments

17 comments

  • Infopro
    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
  • Carmstrongclark
    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
  • Infopro
    What message do you get when trying to restart MySQL exactly?
    0
  • Carmstrongclark
    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
  • ssfred
    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
  • Carmstrongclark
    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
  • twhiting9275
    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
  • Carmstrongclark
    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
  • Carmstrongclark
    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
  • Carmstrongclark
    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
  • rpvw
    What errors (if any) are you seeing in your /var/lib/mysql/HOSTNAME.err file ?
    0
  • Carmstrongclark
    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
  • rpvw
    You did change HOSTNAME to reflect the actual hostname of your server ? Please see this cPanel
    0
  • Carmstrongclark
    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
  • rpvw
    You will probably want to view the file using the
    # cat | less
    command
    0
  • Carmstrongclark
    Ok great :) have done that. The results have been uploaded as a file. Thanks for that
    0
  • rpvw
    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.