Forums

Not Able To Connect To RDS AWS DB

Hello I got an upgraded account today and have mysql RDS linked just fine on my local machine and also on MySQLWorkbench, I enabled allow outside connections when creating the DB so all the ports should be open, but im still getting this error:

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/laner107/IndicatorScript/data.py", line 42, in <module>
db = MySql("laner107", "!Cammisue107", "indicator-data.cyu5vxcv3x4n.us-east-2.rds.amazonaws.com", "intraday_data ")
File "/home/laner107/IndicatorScript/sqlite.py", line 68, in init
self.connect = self.create_connection()
File "/home/laner107/IndicatorScript/sqlite.py", line 73, in create_connection
connection = mysql.connector.connect(
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 'indicator-data.cyu5vxcv3x4n.us-east-2 .rds.amazonaws.com:3306' (111 Connection refused)

Any idea whats going on?

Found the fix:

Simply kill the process and reboot it..

Glad to see that you made it work!

What process was rebooted please?

@giddo4all just a margin note -- on a free account you will not be able to connect with an external service or with your PythonAnywhere database from outside.