Bug #91905 Connecting Python to MySQL by an encrypted file - .mylogin.cnf
Submitted: 6 Aug 2018 6:52 Modified: 8 Nov 2022 17:16
Reporter: Wu TEd Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:8.0.12 OS:CentOS (CentOS6.6)
Assigned to: CPU Architecture:Any

[6 Aug 2018 6:52] Wu TEd
Description:
After creating .mylogin.cnf with mysql_config_editor, I would like use Python MySQL connector to connect to MySQL server with this login path file.

But I got the following error message:

return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0x94 in position 28: ordinal not in range(128)

My code is simple:

import mysql.connector
import os
mysql.connector.connect(option_files=os.path.expanduser('XXX/.mylogin.cnf'))

How to repeat:
1.connect_mysql.py:

    import mysql.connector
    import os
    mysql.connector.connect(option_files=os.path.expanduser('~/.mylogin.cnf'))

2. python connect_mysql.py
[6 Aug 2018 7:44] MySQL Verification Team
Hello Wu TEd,

Thank you for the report/feature request!

Thanks,
Umesh