I'm trying to connect to a mysql database from clojure. I'm using the example code taken from:
http://corfield.org/blog/post.cfm/connecting-clojure-and-mysql but I'm getting this error:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.
The mysql server is bound to 127.0.0.1:3306. Changing localhost to 127.0.0.1 in :subname doesn't help. I have set the mysql server to log everything for debugging, and it doesn't even see a connection coming. What am I doing wrong here?
I can connect to the db using mysql -h 127.0.0.1. But this fails to connect if I change 127.0.0.1 to localhost. my.cnf contains: bind-address = 127.0.0.1 and as I write above, changing to 127.0.0.1 in :subname doesn't help. The thing that did the trick was putting mysqld : ALL : ALLOW in /etc/hosts.allow. I have no idea why this is needed, especially when all the other services that contact the MySQL server work without it.
Related
I recently had an issue with my production systems in which a MySQL server was blocking the application server, due to connection errors, and gave the following error:
Host 'xx.xx.xx.xx' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
I'd like to find a way to simulate this condition (or even trigger the actual condition on a non-production server), so I can respond to it properly. It's a pretty rare problem for my systems, but I'd still like to find a good way to respond to it.
You can avoid this problem by increase peer connections in mysql configurations
Logging to console/terminal with admin privileges
Flush all hosts using mysqladmin:
mysqladmin flush-hosts -u root -p
Open my.cnf (Linux) or my.ini (Windows) and change max_connect_error variable
max_connect_errors= 250000
Restart server with changes
To simulate error connection you can connect to MySQL server and then end connection before succesfull authentication. For example by netcat:
nc -i0.1 <hostname> 3306
It is impossible to connect to mysql that I setup with phpmyadmin on a debian 8 VPS. I have been searching for hours, I have even followed this guide http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html but nothing, it seems imposible to get to connect to it, I even have created a phpmyadmin profile that is not on localhost and on %...
Thanks a lot for helping...
111 means connection refused, so make sure your mysql config is correct, and check your firewall.
Mysql config details (from Can't connect to MySQL server error 111):
If you have lines like this :
skip-networking
bind-address = 127.0.0.1
In your my.cnf configuration file, you should comment them (add a # at the beginning of the lines), and restart MySQL.
That's the first thing to try. Then try turning off any firewall and connecting again. That will tell you whether there's a firewall problem.
I have a home-hosted MySQL Server which for some reason is giving me this:
Connection failed: Can't connect to MySQL server on '9x.x.xxx.xx4' (111)
I've portforwarded 3306, and when looking for solutions, for example, putting a hashtag before "bind-address", it would not connect me at all. Another example is changing the "bind-address" value to my public IP, but that gave me the same error. I can connect on phpMyAdmin, but not on an external IP or a php file.
Is there anything else I can try?
EDIT: I'm now getting this:
Connection failed: Can't connect to MySQL server on '9x.x.xxx.xx4' (110)
Is this something different, or the same?
Okay, I figured it out. In the my.cnf file it had this line:
bind-address: 127.0.0.1
I typed ifconfig into the Linux command prompt which gave me my local IP details. All I had to do is change it to that IP. Example:
bind-address: 192.168.0.X
Thank you to everyone to tried to help me out!
Edit: I really frown at my younger-self.
What would've been ideal is to actually put bind-address: 0.0.0.0, to have the MySQL server listen on all interfaces. But, I was 13 or 14, so ¯\_(ツ)_/¯
I have been trying to share a MySQL database across our internal network but I am having no luck getting it to work. I am using MAMP. I have edited the my.cnf template and commented out the bind-address line so it looks like this: #bind-address = 127.0.0.1
The IP of the machine that is hosting the MySQL database is 192.168.0.152. When I put this IP in when making a MySQL connection via PHP I get the following error:
Can't connect to MySQL server on '192.168.0.152' (61)
Obviously I am missing a step somewhere. What else am I need to do?
I have mysql installed several months ago. However I do remember using mysql workbench successfully at one point of time. Today I try launching it and get following error
Lost connection to MySQL server at 'reading initial communication packet', system error: 61
open /etc/mysql/my.cnf in a text editor and try changing:
bind-address = 127.0.0.1
to
#bind-address = 127.0.0.1
and then restart MySQL.
Try using the connection method: Local Socket/Pipe.
If you are trying to use the MySQL Workbench and connect through an SSH tunnel, you will get this error when your SSH connection does not complete successfully (e.g. improper host, password, key file, etc)
A good way to trouble shoot this is to separately test the the ssh connection from the machine you are trying to connect from and establish that you can do so succesfully.
I came across the same problem.I fix this below:
3306 port may be occupied by other process, so mysql change the port to 3307(or nearly other port 3308...).So when you connect,change the port to 3307 and try