How to make mysql connection that requires CA-CERT with sqlalchemy or SQLObject

To use SSL certs with SQLAlchemy and MySQLdb, use the following python code:

db_connect_string='mysql://<user>:<pswd>@<db server>:3306/<database>'
ssl_args = {'ssl': {'cert':'/path/to/client-cert', 
                     'key':'/path/to/client-key', 
                      'ca':'/path/to/ca-cert'}}

create_engine(db_connect_string, connect_args=ssl_args)

Leave a Comment