Boba Fit
Boba Fit

Reputation: 829

python3 mariadb ssl: The requested data were not available

I got a python3 script that should connect to a mariadb. I need to encrypt the traffic. When I connect via mariadb-CLI then I succed.

But when i run my script I'll get:

mariadb.OperationalError: SSL connection error: The requested data were not available.

Here is the sript:

#!/usr/bin/env python3
import mariadb
db=mariadb.connect(
    host='example.com',
    user='boba_fit',
    password='I publish all my passwords in stackoverflow',
    port=3306,
    database='test_db',
    ssl_key='/etc/mysql/ssl/mariadb-cert.pem',
    ssl_cert='/etc/mysql/ssl/mariadb-key.pem',
    ssl_ca='/etc/mysql/ssl/ca-cert.pem'
)

Python 3.8.6
python-mariadb 1.0.1
MariaDB: 10.1.44-MariaDB-0ubuntu0.18.04.1

Upvotes: 1

Views: 1113

Answers (1)

Thomas Bürli
Thomas Bürli

Reputation: 71

The key and cert parameter are the wrong way around.

It should be: ssl_key= /./.../key.pem ssl_cert= /./.../cert.pem

Upvotes: 1

Related Questions