farcepest / MySQLdb1

MySQL database connector for Python (legacy version)
https://sourceforge.net/projects/mysql-python/
667 stars 318 forks source link

SSL options ignored when using read_default_file option #144

Open travispaul opened 5 years ago

travispaul commented 5 years ago

I have a cnf file that works with the MySQL client:

[root@host ~]# cat /root/.my.cnf
[client]
user = someuser
password = somepass
host = some.remote.host
ssl-ca = /etc/pki/mysql/rds-combined-ca-bundle.pem
[root@host ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 7576589
Server version: 5.6.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show status like 'Ssl_cipher';
+---------------+--------------------+
| Variable_name | Value              |
+---------------+--------------------+
| Ssl_cipher    | DHE-RSA-AES256-SHA |
+---------------+--------------------+
1 row in set (0.00 sec)

MySQL [(none)]>

However, when using this file with MySQLdb, the SSL options appear to be ignored:

>>> import MySQLdb
>>> db=MySQLdb.connect(read_default_file="/root/.my.cnf")
>>> db.query("show status like 'Ssl_cipher'")
>>> r=db.store_result()
>>> r.fetch_row()
(('Ssl_cipher', ''),)

Using version 1.2.5 on CentOS