Skip to content

PyMySQL/myloginpath

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

404ac6a · Dec 14, 2023

History

32 Commits
Dec 14, 2023
May 31, 2021
May 21, 2023
May 8, 2018
May 8, 2018
Jun 2, 2023
Sep 15, 2021
May 31, 2021
Jun 2, 2023
Jun 9, 2023
May 21, 2023

Repository files navigation

MySQL's login path file reader

Decrypt and parse MySQL's login path file.

See also: https://dev.mysql.com/doc/refman/8.0/en/mysql-config-editor.html

Install

$ pip install myloginpath

Example

Create login path file with mysql_config_editor command:

$ mysql_config_editor set --login-path=client --host=localhost --user=localuser --password
Enter password: <Type password here>

Use it from Python:

import myloginpath, MySQLdb
conf = myloginpath.parse('client')
print(conf)  # {'host': 'localhost', 'user': 'localuser', 'password': 'secretstring'}
conn = MySQLdb.connect(**conf, database="myapp")