Mysql Remote IP blocked
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?
mysql-5.6 remote
bumped to the homepage by Community♦ 3 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
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?
mysql-5.6 remote
bumped to the homepage by Community♦ 3 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
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?
mysql-5.6 remote
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?
mysql-5.6 remote
mysql-5.6 remote
asked Oct 16 '16 at 21:49
dvdmierdendvdmierden
1
1
bumped to the homepage by Community♦ 3 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 3 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Well, it took a couple of years of my life, but I think I've figured it out.
I had to increase two mysql database configuration values (in /etc/mysql/my.ini) :
- max_connections (from 100 to 500 , for now)
- max_connect_errors (from 10 to 10.000)
After that, I ran flush hosts
on the mysql prompt to clear any blocked hosts.
The forum experiencing these issues is generating some heavy database queries (mainly statistics into a table with over 1 million records - not sure why this would be "difficult", but that's another topic).
I assume this causes a temporary lockup and ultimately a lack of allowed connections. This in turn temporarily blacklists the webserver altogether!
After that, the database was accessible via the web interface again!
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f152426%2fmysql-remote-ip-blocked%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Well, it took a couple of years of my life, but I think I've figured it out.
I had to increase two mysql database configuration values (in /etc/mysql/my.ini) :
- max_connections (from 100 to 500 , for now)
- max_connect_errors (from 10 to 10.000)
After that, I ran flush hosts
on the mysql prompt to clear any blocked hosts.
The forum experiencing these issues is generating some heavy database queries (mainly statistics into a table with over 1 million records - not sure why this would be "difficult", but that's another topic).
I assume this causes a temporary lockup and ultimately a lack of allowed connections. This in turn temporarily blacklists the webserver altogether!
After that, the database was accessible via the web interface again!
add a comment |
Well, it took a couple of years of my life, but I think I've figured it out.
I had to increase two mysql database configuration values (in /etc/mysql/my.ini) :
- max_connections (from 100 to 500 , for now)
- max_connect_errors (from 10 to 10.000)
After that, I ran flush hosts
on the mysql prompt to clear any blocked hosts.
The forum experiencing these issues is generating some heavy database queries (mainly statistics into a table with over 1 million records - not sure why this would be "difficult", but that's another topic).
I assume this causes a temporary lockup and ultimately a lack of allowed connections. This in turn temporarily blacklists the webserver altogether!
After that, the database was accessible via the web interface again!
add a comment |
Well, it took a couple of years of my life, but I think I've figured it out.
I had to increase two mysql database configuration values (in /etc/mysql/my.ini) :
- max_connections (from 100 to 500 , for now)
- max_connect_errors (from 10 to 10.000)
After that, I ran flush hosts
on the mysql prompt to clear any blocked hosts.
The forum experiencing these issues is generating some heavy database queries (mainly statistics into a table with over 1 million records - not sure why this would be "difficult", but that's another topic).
I assume this causes a temporary lockup and ultimately a lack of allowed connections. This in turn temporarily blacklists the webserver altogether!
After that, the database was accessible via the web interface again!
Well, it took a couple of years of my life, but I think I've figured it out.
I had to increase two mysql database configuration values (in /etc/mysql/my.ini) :
- max_connections (from 100 to 500 , for now)
- max_connect_errors (from 10 to 10.000)
After that, I ran flush hosts
on the mysql prompt to clear any blocked hosts.
The forum experiencing these issues is generating some heavy database queries (mainly statistics into a table with over 1 million records - not sure why this would be "difficult", but that's another topic).
I assume this causes a temporary lockup and ultimately a lack of allowed connections. This in turn temporarily blacklists the webserver altogether!
After that, the database was accessible via the web interface again!
answered Oct 21 '16 at 21:19
dvdmierdendvdmierden
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f152426%2fmysql-remote-ip-blocked%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown