Errno 111 connection refused python mysql

Is mysql.database.azure.com blocked from access?

Hi ,

I trying to run sql from my python script but hit below error: Is it due to azure.com block?

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/mysql/connector/network.py", line 607, in open_connection self.sock.connect(sockaddr) ConnectionRefusedError: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/okl/ibox_wkly_svs_lvl", line 7, in <module> mydb = connection.connect(host="xxxxxxxxx.mysql.database.azure.com", database = 'xxxxx',user="xxxxxxx@xxxxxxxemysql", passwd="xxxxxx",use_pure=True) File "/usr/local/lib/python3.9/site-packages/mysql/connector/__init__.py", line 271, in connect return MySQLConnection(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/mysql/connector/connection.py", line 107, in __init__ self.connect(**kwargs) File "/usr/local/lib/python3.9/site-packages/mysql/connector/abstracts.py", line 985, in connect self._open_connection() File "/usr/local/lib/python3.9/site-packages/mysql/connector/connection.py", line 308, in _open_connection self._socket.open_connection() File "/usr/local/lib/python3.9/site-packages/mysql/connector/network.py", line 609, in open_connection raise errors.InterfaceError( mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'depotboxcaremysql.mysql.database.azure.com:3306' (111 Connection refused)

Thanks]

okl | 11 posts | Oct. 24, 2021, 12:23 p.m. | permalink

I've added .mysql.database.azure.com to the whitelist. Try again.

fjl | 3377 posts | PythonAnywhere staff | Oct. 24, 2021, 12:34 p.m. | permalink

Hi

Not working , could it be you need the whole address?

"depotboxcaremysql.mysql.database.azure.com"

okl | 11 posts | Oct. 24, 2021, 1:15 p.m. | permalink

Sorry, I just realized that it would not work for the free account as it is not http connection, so the whitelist is not relevant.

fjl | 3377 posts | PythonAnywhere staff | Oct. 24, 2021, 1:19 p.m. | permalink

Postingan terbaru

LIHAT SEMUA