Skip to content

read_default_file doesn't work for SSL parameters #1020

@ryantm

Description

@ryantm

Describe the bug
I am trying to use read_default_file to configure the pymysql connection

To Reproduce

Use pymysql version 1.0.2.

Have a mysql config file like:

[mysql]
comments=1
default-character-set = utf8mb4
host = databasehost.example.com
database = dbname
ssl_key = /etc/mysql/client/key.pem
ssl_cert = /etc/mysql/client/cert.pem
ssl_ca = /etc/mysql/client/ca.pem

Code:

import pymysql
conn = pymysql.connect(
          read_default_file=database_default_file,
          read_default_group='mysql',
          user=username, password=password, autocommit=True)

and if the user grant requires SSL it fails to connect.

If I change the code to

import pymysql
conn = pymysql.connect(
          read_default_file=database_default_file,
          read_default_group='mysql',
          user=username, password=password, autocommit=True,
          ssl_ca="/etc/mysql/client/ca.pem",
          ssl_cert= "/etc/mysql/client/cert.pem",
          ssl_key="/etc/mysql/client/key.pem")

It connects

Expected behavior

The ssl parameters don't have to be separately specified.

Environment

  • OS: NixOS
  • Server and version: mysql Ver 15.1 Distrib 10.1.47-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
  • PyMySQL version: 1.0.2

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions