Connect To Remote Mysql Via Python
I have installed MySQL on a remote server. I also created some databases with some tables in them, all via SSH. I have created the following users: CREATE USER 'myname'@'localhost'
Solution 1:
It's likely MySQL is bound to localhost. Assuming you're using a Linux machine:
On your remote machine, edit /etc/mysql/my.cnf
Find bind-address=127.0.0.1
, edit it to bind-address=0.0.0.0
, or just remove the line.
Restart MySQL
Read more: http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_bind-address
Solution 2:
The connection refused
error message actual means that it was not possible to open a TCP socket. The server refused the connection. This is not related to the authentication or user permissions since the refusal happens on the OS level before the MySQL server is involved. Possible causes are:
- the MySQL server is bound to localhost only → set the listening address to the servers real IP address or 0.0.0.0 in mysql.conf
- there is a firewall in between → reconfigure/deactivate the firewall
- your connection details (server/port) are wrong → check them again
Post a Comment for "Connect To Remote Mysql Via Python"