How to connect Django to a mysql database over an ssl connection?

I'm trying to connect Django to a mysql database which is accessible through an ssl connection. How do I configure this?

My first guess would be setting the 'OPTIONS' property of the database definition. However, I can't find info on what possible options to use. The option 'ssl': '/map/to/ca-cert.pem' does not work.

The following command seems to work:

mysql -h -u lizard -p --ssl-ca=./ca-cert.pem

Edit: Ok I'm looking at the python-mysqldb documentation... maybe I can find the answer there.


Django uses the Python MySQLdb library to interface with MySQL. Looking at the MySQLdb connection documentation, it looks like the ssl option requires a dictionary argument. So this might work:

'OPTIONS': {'ssl': {'key': '/map/to/ca-cert.pem'}}

Need Your Help

heroku javascript ajax post not returning anything

javascript ajax post heroku

I'm trying to do a ajax post to a heroku server app and have the app return a response to the client web page (on a different server).

What SNMP library for .NET makes traps, sets or gets simple?

.net networking network-protocols snmp

What are the best SNMP libraries to use with .NET? Specifically for listening for traps or sending set or get requests.