添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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.

  • You can install and run a native database server on almost any hosting provider that offers containerized, virtual or dedicated servers.
  • The bigger hosting providers mostly offer also managed databases (aka DBaaS) in different flavors.
  • There are also some providers who specialize in DBaaS and only offer these services.
  • Here is a list of “free” database hosting providers for testing or small projects. Of course, the features are limited and their service can be shutdown at any time:
  • https://gist.github.com/bmaupin/0ce79806467804fdbbf8761970511b8c
  • https://free-for.dev/#/?id=managed-data-services
  • Thanks for stopping by! We use cookies to help us understand how you interact with our website. By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.

    Strictly necessary cookies

    These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.

    Performance cookies

    These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.

    Functional cookies

    These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.

    Targeting cookies

    These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.

    Reject all Accept all