Reputation: 562
I have a server in my office running MySQL. I've connected to this server from laptops and PCs far and wide. However, when trying to connect into it from a Google Cloud Compute Engine VM Instance I'm getting the following error:
>>> import mysql.connector
>>> dbconfig = {'host': 'redacted', 'user': 'redacted', 'database': 'redacted', 'password': 'redacted'}
>>> cnx = mysql.connector.connect(**dbconfig)
Traceback (most recent call last):
File "/home/me/anaconda3/lib/python3.7/site-
packages/mysql/connector/connection_cext.py", line 176, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Lost connection to MySQL server at 'reading initial communication packet', system error: 104
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/__init__.py", line 172, in connect
return CMySQLConnection(*args, **kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 78, in __init__
self.connect(**kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/abstracts.py", line 731, in connect
self._open_connection()
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 179, in _open_connection
sqlstate=exc.sqlstate)
mysql.connector.errors.OperationalError: 2013 (HY000): Lost connection to
MySQL server at 'reading initial communication packet', system error: 104
The VM is an Ubuntu 16.04.5 installed last month from the stock image. I tried the connection from python 3.7 console using mysql-connector-python.
Is there any firewall rule I need to add perhaps?
Upvotes: 0
Views: 163
Reputation: 562
My bad, our IT closed the 3306 port in the firewall. I tried accessing the server from outside our network and found out it wasn't accessible anymore. Thanks for doubting me John
Upvotes: 2