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

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

问题描述

我想通过flask连接到mysql服务器

I want to connect to a mysql server via flask and

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

如何将 ca-cert、client-key 和 client-cert 添加到连接中?

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

推荐答案

您可以像这样在 URI 中添加这些信息:

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'

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

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

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

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