Connect to MySQL using pymysql and  login-path that was setup with mysql_config_editor

tradeinfo
tradeinfo used Ask the Experts™
on
When using pymysql, is there a way to connect to MySQL database using a login-path created with mysql_config_editor?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Commented:
So pymysql is just a pure Python MySQL/MariaDB client.

You connect the same way you'd connect using the native mysql client (user/pass or passing a defaults file which includes user/pass).

Keep in mind, depending on type of work you're doing, pymysql can be orders of magnitude slower than mysql.

Also pymysql will have subtle differences from the native mysql client which will be maddening to try + figure out.

Likely best to stick with the native mysql client, unless you just have time to burn tracking down weird problems.
Top Expert 2004
Commented:
Based on a brief review of the code, I'm going with "no".  The code has no support for saved credentials, and in fact handles the raw socket communication with MySQL itself.  Since it is not using the mysql command line client, you would have to implement the credential read yourself.

Author

Commented:
Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial