How to use Alembic with a SSL connection?

大兔子大兔子 提交于 2019-12-25 00:33:17

问题


I use Alembic to manage my migrations. My database is on AWS, and I want to connect it with SSL.

In my alembic.ini I have the lines

[production]
script_location = alembic_prod
sqlalchemy.url = mysql+pymysql://user:password@my-rds-host.eu-west-1.rds.amazonaws.com/mydatabase

Of course, it works if user have the permission to connect the base without SSL, but not otherwise.

How to require a SSL connection, and specify the certificate ?


回答1:


You first need the certificate bundle -

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.SSLSupport

You then would add the appropriate parameter to your URL like shown here -

How to connect to mysql server with SSL from a flask app



来源:https://stackoverflow.com/questions/46317055/how-to-use-alembic-with-a-ssl-connection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!