e.g. http://dev.mysql.com/doc/refman/5.5/en/blocked-host.html
Host 'host_name' is blocked because of many connection errors.
Unblock with 'mysqladmin flush-hosts'
basically, I wanna block localhost from being able to connect mysql somehow with this error
story: in production, I had and endless stream of this in the logs, and basically the site was down until I SSH'ed in and did what it said: run flush-hosts
so, my goal is to reproduce this so I can figure out a way to alert on it or stop it from happening!
But... I don't know how to make it happen! Anyone know how?
So far I've tried random stuff like telnet localhost 3306 and Ctrl-C'ing out if and stuff
Related
I know that this is a fairly common error, but the curious thing is that in this case the credentials work when I'm logged in to Docker and working with mysql in the terminal. But when I try to use a client like DBeaver or MySQL Workbench, or even making an API call via Python, I get the error "Access denied for user 'root'#'localhost".
I thought it might be because I have another local MySQL database using port 3600, so I changed it to 3700 but the problem persists. I've made sure that the image is running in the Docker application, and besides, as mentioned, it works using the terminal. This is on MacOS Ventura. If there's any other information I can provide that would help, please let me know. Any assistance is appreciated!
What a strange problem!
I have the same applications running in different mysql(dev and test environment)
both 2 mysql are totally the same.
but today in dev environment, I came up with an error like this(which is never happened before):
Host 'Hostname' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts
I also find the solution to this problem, like below
here is the solution of same question but not solved
there are 24 connections in the connection pool of my applications, none of them will fail and there are also no failures at all.
Using show variables like "%max_connect%" I can see max_connect_errors are 100.
My application runs in the same ip as my navicat.
By show processlist I can see there are no other connections except navicat connection before application start. And then I tried to start my application, the problem occured and I cannot even start up my application!
after flush hosts, all the applications will be run in normal without any problem, but when I tried to restart them, the problem shows again.
I don't know what's going on!
I have 4 applications using DB, and the mysql configuration is showing below:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${my-config.mysql.host}:${my-config.mysql.port}/${my-config.mysql.db-name}?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&allowMultiQueries=true
username: ${my-config.mysql.username}
password: ${my-config.mysql.password}
validation-query: SELECT 1
test-on-borrow: true
test-while-idle: true
time-between-eviction-runs-millis: 10000
hikari:
minimum-idle: 1
maximum-pool-size: 10
you can see that: even all the applications use connections in the maximum pool size, ther should be only 40 connections, and also even all of them failed there are only 40 failures.
So far I have noticed that using show processinglist after flush hosts there are always 1 or 2 unauthorized connections like this:
maybe this is why my application will always down after restarting.
But I notice that that unauthorized connection is from my computer and I did not run any other applications...
Another problem is that, when the problem occurs, it shows
Host '192.168.18.19' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"
but all the other existing connections using the same IP will not receive such report, they works well and can reach to mysql!
you can see that my gateway application was toasted because of the problem.
but my message center application using the same IP can get infomation from mysql(only if it can get rows from mysql, it print those words like 配置已更新).
If mysql blocked my IP, why other applications using the same IP will not be blocked?
Am I hacked?
I'm running MariaDB v10.0.14 on a Windows 2012R2 Server, and I work locally from a Win7 machine. I'm limiting this problem to using the command line client tool. I am encrypting the connection to the server DB with SSL. I can connect and issue commands, however after being idle for 60s I get:
ERROR 2013 (HY000): Lost connection to MySQL server during query
When I re-issue the command I get:
ERROR 2006 (HY000): MySQL server has gone away.
No Connection. Trying to reconnect...
Then the client reconnects and runs the command. I don't know why this is occurring and am worried it may affect DB users' connections. Some troubleshooting:
When I connect without SSL this does not occur
I have been ignoring this issue for a while so can not say what change may have led to this. I certainly remember connecting with SSL in the past and not having these timeouts.
I can RDP to the server, connect to DB with command line tool and SHOW FULL PROCESSLIST. I can see the localhost connection plus the remote client connection. When the client has just been started I see Command as 'Sleep' and State as 'cleaning up'. I can issue commands from the client. When Time > 60 State changes to Null and the client shows the above symptoms.
I've read through this, tried all standard suggestions but can't even seem to find any mention of this behaviour. Is it normal?
Wait_timeout and interactive_timeout are set at 28800 so I don't think this is the problem.
net_read_timeout=30 and net_write_timeout=60 but these are tiny commands
connect_timeout=10 but connection is not the issue.
Credentials and permissions are fine as I can connect originally.
Error log has entries corresponding to this event as:
Aborted connection xxx to db: <dbname> user: '<user>' host: '<host>' (Unknown Error)
Firewall logs show that traffic seems to be flowing just fine.
I took a capture of network traffic on the server and saw the below. The blue is the original connection. In orange you can see that at 73s I issue a new command which is met in red with [FIN, ACK] then [RST, ACK] from the server. The green afterward is when the command is reissued and the reconnection occurs. Note the change in client port. Handshakes seem to be fine. Beyond that I'm lost. I'm a data guy, not a network guy.
Anyone have any insights or ideas? Thanks.
Output for
show variables like '%timeout%';
(can't post more than 2 links. I should answer some questions)
connect_timeout=10
deadlock_timeout_long=500000000
deadlock_timeout_short=10000
delayed_insert_timeout=300
innodb_flush_log_at_timeout=1
innodb_rollback_on_timeout=OFF
interactive_timeout=28800
lock_wait_timeout=31536000
net_read_timeout=30
net_write_timeout=60
slave_net_timeout=3600
wait_timeout=28800
Sorry if it comes a bit late, but the reason is this bug https://jira.mariadb.org/browse/MDEV-9836 . SSL connection were aborted after net_read_timeout (which is quite short) not after net_wait_timeout.
So I have been trying to get XAMPP up and running for awhile now. I see there is plenty of documentation on this problem but most of them don't seem to be helping my situation so I would really appreciate someones help walking me through this.
Ok when I started apache wouldn't start but when I changed it so that it would be using port 85 that at least started. My next problem has been with MySql. It is currently running on port 3306 (I had something else that was using that port but I deleted it) when I click to start MySql it just says it is attempting to start but doesn't do anything. When I go to phpMyAdmin I get this error message
2002 - No connection could be made because the target machine actively refused it.
The server is not responding (or the local server's socket is not correctly configured).
Are there any procedures I can go though to get this thing up and running?!
I am facing connection failure to MySQL problem when I run my program for more than couple of days.MySQL Error Code is 2013 while connecting to Database. MySQL server and client programs are both on same machine. I am using FC5 as my OS and MySQL version is 5.0.18. Can anybody throw some light on this?
I am getting mysql error 2013 while calling mysql_real_connect()...
Any help is appreciated.
Try using localhost, instead of your own IP.
I don't know why, but this immediately fixed the problem for me.
I would be very grateful if someone could clarify
why this worked, all of a sudden.
Sounds like a firewall issue. Have you tried disabling the firewall temporarily?
Another possible solution involves edition the startup script as mentioned here and commenting out the following line:
SKIP=skip-networking
A third possible solution is mentioned here. The user tried to access an InnoDB database and InnoDB support was accidentially deactivated for the MySQL server.
(new) I found this official MySQL article which has lots of approaches to solve the problem. Did you modify the wait_timeout system variable?
Here's an answer you might not expect. I had encountered the same problem. MySQL Error 2013. Here are the symptoms:
PHPMyAdmin fired off 2013 and error 95.
I could shell into the MySQL monitor, but it took an inordinately long time to start. I could view tables and everything worked once the command line utility started
The server took a LONG time to stop and restart.
No errors in the MySQL error log.
I work with a good sysadmin who checked netstat -tn, which yielded the answer:
tcp 0 0 [my.srv.ip]:3306 184.73.87.215:59271 ESTABLISHED
tcp 0 1 [my.srv.ip]:38138 184.73.87.215:113 SYN_SENT
The IP resolves to Amazon Web Services. Some prick was leeching onto my 3306, even though everything but port 80 is allow-only. It's time to review my firewall rules.
There were no new tables, and mtop didn't show any activity, but I found a ton of these in the auth log:
Apr 19 15:14:52 magic2 mysqld[18953]: refused connect from ec2-184-73-87-215.compute-1.amazonaws.com
Apr 19 15:18:02 magic2 mysqld[18953]: refused connect from ec2-184-73-87-215.compute-1.amazonaws.com
After blocking the offending IP in iptables, the problem suddenly went away. Sneaky Bastards. The moral of this story is: What looks like bug, might be a hacker.
bz
Check your my.cnf. Set your bind-address to the server's IP address. Solved the issue for me. NO ONE seemed to know the answer to that one!
My fix was - change 'localhost' to '127.0.0.1'
It could be a network error that caused the TCP/IP connection to drop, or the wait_timeout was exceeded on the server; the latter can actually be useful in keeping the # of open connections down, but the app will then need to handle errorcode 2013 correctly!!