Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Mar 2007
Intermittent "Can't connect to MySQL server"
Recently, I started getting small periods of intermittent connection errors (Error number 2002) about once every hour, lasting for about 1 to 5 minutes each time:
Can't connect to local MySQL server through socket
I am not using persistent connections, I have verified that all PHP scripts close their connection to mysql, and the maximum connection limit is twice that of the maximum amount of users online at once.
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 5 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.
- I changed the maximum amount of open files allowed by the operating system from 1024 to 30000.
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