Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    3

    Unanswered: Intermittent "Can't connect to MySQL server"

    Hi there,

    Recently, I started getting small periods of intermittent connection errors about once every hour, lasting for about 1 to 5 minutes each time:
    Can't connect to local MySQL server through socket
    '/var/lib/mysql/mysql.sock'

    I enabled the error log and did some other monitoring and established 2 things:
    - the server doesn't crash/restart, it keeps running throughout the errors
    - the errors do not match the load on the website, as sometimes when 500 users are online there are no errors, but when 300 are online they may by prolific

    I checked many forums and then made 4 changes:
    - changed the directory containing the mysql.sock file so only file owners or superusers can delete files from it
    - I changed the default socket file setting in both my.cnf and php.ini
    - I read about SELinux causing such a problem, so I disabled SELinux completely, rebooted the server and double-checked that it is indeed disabled.

    Despite all these changes, I still get the errors. I then read that there is a workaround by using TCP/IP instead of the sock file. I tried that, but I still get the error intermittently in the form of:
    Can't connect to MySQL server on 127.0.0.1

    This is a extremely frustrating problem, it's been bugging us for weeks, anyone who can offer some help - it will be greatly appreciated!

    MySQL server 4.1.20, PHP 4.3.9, client API 4.1.20, CentOS 4.3, Intel P4 2.8GHz 1GB RAM

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    is it possible you have a rogue script which is not closing its connection or properly clearing up after itself

    if your web scripting engine allows a persistent connectiona re you making use of that persistance.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2007
    Posts
    3
    I already checked all the code to see that all connections are closed and disabled persistent connections

  4. #4
    Join Date
    Feb 2007
    Posts
    3
    I have now also increased the amount of open files allowed by the operating system from 1000 to 30000. Still the same problem. Anyone, please help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •