【问题标题】:Using mysql-connector-python in a flask app with uwsgi and receive the following error: SSL connection error: SSL_CTX_new failed在带有 uwsgi 的烧瓶应用程序中使用 mysql-connector-python 并收到以下错误:SSL 连接错误:SSL_CTX_new 失败
【发布时间】:2019-02-26 23:52:40
【问题描述】:

我有一个烧瓶应用程序,它使用我已在开发模式下成功运行的 mysql 连接。为了扩展应用程序,我打算结合使用 Nginx 和 uwsgi。

已设置 wsgi.py 文件并运行命令:

uwsgi --socket 0.0.0.0:5000 --protocol=http -w wsgi:app

输入网址后我收到以下错误消息(以前在开发模式下工作,即在没有 uwsgi 的情况下自行烧瓶):

mysql.connector.errors.InterfaceError: 2026 (HY000): SSL connection error: SSL_CTX_new failed

我已经尝试过这里建议的解决方案: https://forums.mysql.com/read.php?50,671354,671376#msg-671376 但是它不起作用。

我应该怎么做才能解决这个错误?

【问题讨论】:

    标签: python mysql ssl flask uwsgi


    【解决方案1】:

    我找到了适合我的解决方案。

    https://stackoverflow.com/a/56497954/9137086

    添加

    use_pure=True
    

    到数据库连接字符串的末尾

    所以我的变成了

    connection_string = f'{dialect}+{driver}://{user}:{password}@{host}:{port}/{database}?use_pure=True'
    

    【讨论】:

      猜你喜欢
      • 2020-09-30
      • 2019-09-29
      • 2014-11-17
      • 1970-01-01
      • 1970-01-01
      • 2013-05-14
      • 2018-12-02
      • 2013-09-01
      • 1970-01-01
      相关资源
      最近更新 更多