I have a peculiar issue with some database connections: I've got this (test) script on 2 different servers:
$link = mysql_connect($db_server, $db_user, $db_passwd);
if (!$link) {
die('Could not connect: ' .mysql_errno().":". mysql_error());
} else {
echo 'Connected successfully';
}
mysql_close($link);
exit;
On one server, there's no issue at all. On the other server, the connection is refused from time to time, with the following message:
Could not connect: 2002:Operation not permitted
Obviously, both hosts aren't blocked by the db server firewall (but I've explicitly whitelisted the problematic IP address anyway)
Most forums indicate it might be a problem with the lock file, mysql-server not running, or any global issues, but it seems like this specific remote host is blocked, all other websites and remote hosts connect perfectly.
I've attempted to set the global max_connect_errors to 10.000 , but that didn't help either. I do believe it has to do with connection errors from the offending server. It has some slow query issues already, and with the site being visited more often, the issue comes back more frequently. After (exactly) ten minutes, the remote host is unblocked again, and everything works as it should.
I've also tried restarting mysqld, rebooting the server.
But I'm running out of options. Any thoughts on how to prevent this, or at least resolve it when the issue occurs?
Asked by dvdmierden
(111 rep)
Oct 16, 2016, 09:49 PM
Last activity: Feb 15, 2025, 06:03 PM
Last activity: Feb 15, 2025, 06:03 PM