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

前端 未结 3 834
花落未央
花落未央 2020-12-20 19:26

I want to connect to a mysql server via flask and

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


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-20 19:47

    In case you need to use a Cloud-based MySQL service, this configuration will be slightly different. For example,

    In Azure, it will be,

    app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://your-username:your-password@localhost/your-schema?ssl_ca=BaltimoreCyberTrustRoot.crt.pem'
    

    wherein, the file BaltimoreCyberTrustRoot.crt.pem can be downloaded from here.

    Similarly, the solution for AWS is discussed here.

提交回复
热议问题