Hello,
I am facing an issue with my Streamlit application when connecting to my local MySQL database. Here are the details of the error:
[22:41:36.439] Uncaught app exception
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.9/site-packages/pymysql/connections.py", line 644, in connect
sock = socket.create_connection(
File "/usr/local/lib/python3.9/socket.py", line 844, in create_connection
raise err
File "/usr/local/lib/python3.9/socket.py", line 832, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.__dict__)
File "/app/av/1_🔐_Connexion.py", line 9, in <module>
db = pymysql.connect(**db_config)
File "/home/appuser/venv/lib/python3.9/site-packages/pymysql/connections.py", line 358, in __init__
self.connect()
File "/home/appuser/venv/lib/python3.9/site-packages/pymysql/connections.py", line 711, in connect
raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 99] Cannot assign requested address)")
Additionally, I noticed that Streamlit mentions a new version is available, but I’m not sure if I should upgrade before resolving this issue.
Can you provide guidance on how to resolve this error, and would upgrading Streamlit possibly help?
Thanks in advance for your assistance.