I've read through a number of queries similar to this but none of them seems to solve the problem The original poster usually seems to find a workaround.
I cannot connect MySQL Workbench to my database on pythonanywhere
The error message says:
Lost connection to MySQL server at 'reading initial communication packet', system error: 0
When I try to run this code in python, I also get an error
import mysql.connector
import sshtunnel
sshtunnel.SSH_TIMEOUT = 5.0
sshtunnel.TUNNEL_TIMEOUT = 5.0
with sshtunnel.SSHTunnelForwarder( ('ssh.eu.pythonanywhere.com'), ssh_username='xxxx', ssh_password='xxxx', remote_bind_address='xxxx.mysql.pythonanywhere-services.com', 3306)) as tunnel:
connection = mysql.connector.connect(user='xxxx', password='xxxx',host='127.0.0.1', port=tunnel.local_bind_port,database='minimal_flask',)
# Do stuff
connection.close()
I get the error message:
2020-05-14 16:26:40,466| ERROR | Secsh channel 0 open FAILED: open failed: Administratively prohibited
2020-05-14 16:26:40,468| ERROR | Could not establish connection from ('127.0.0.1', 57196) to remote side of the tunnel
I do have MySQL running on my local machine listening on 3306 and it seems like that may be the problem but I don't know how to fix it
I can ssh successfully from my local machine to the python anywhere server using bash terminal but when I connect from that terminal to the MySQL instance, it says it's denied with this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I use MySQL Workbench quite a lot and am pretty comfortable using it. I have previously set it up and connected successfully to remote servers and it has been fine