如何从烧瓶应用程序使用SSL连接到MySQL服务器 [英] How to connect to mysql server with SSL from a flask app

查看:136
本文介绍了如何从烧瓶应用程序使用SSL连接到MySQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过烧瓶连接到一个mysql服务器,并且

$ $ $ $ $ $ $ app.config ['SQLALCHEMY_DATABASE_URI'] ='mysql: //你的用户名:your-password @ localhost / schema'

如何添加ca-cert ,客户端密钥和客户端证书连接?

解决方案

您可以添加这些信息在你的URI像这样: p>

  app.config ['SQLALCHEMY_DATABASE_URI'] ='mysql:// your-username:your-password @ localhost / schema?ssl_key = MyCertFolder / client-key.pem& ssl_cert = MyCertFolder / client-cert.pem'

或者使用SQLAlchemy create_engine,看看这篇文章


I want to connect to a mysql server via flask and

app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://your-username:your-password@localhost/schema'

How can I add ca-cert, client-key and client-cert to the connection?

解决方案

You can add theses informations in your URI like this :

app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://your-username:your-password@localhost/schema?ssl_key=MyCertFolder/client-key.pem&ssl_cert=MyCertFolder/client-cert.pem'

Or using the SQLAlchemy create_engine, take a look to this post

这篇关于如何从烧瓶应用程序使用SSL连接到MySQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆