sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) ([Errno 13] Permission denied)")

506 views
Skip to first unread message

Hari Ananthuni

unread,
Aug 18, 2020, 12:33:18 PM8/18/20
to sqlalchemy

I'm trying to connect to mysql using below

engine = create_engine("mysql+pymysql://user:pwd@localhost/test") connection = engine.connect()

it works while in local and when deployed the code in one of our linux box , am getting

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'xxx.xx.xx.xxx' ([Errno 13] Permission denied)")

I checked the user privileges and the user has all the necessary privileges.

using the same user and am able to connect from python terminal from the same linux box but it doesnt work using the python code.

Any suggestions if am missing anything?

Jonathan Vanasco

unread,
Aug 18, 2020, 3:00:26 PM8/18/20
to sqlalchemy
using the same user and am able to connect from python terminal from the same linux box but it doesnt work using the python code.

When this works in the terminal, how are you connecting?  In Python via the database driver, or using the mysql client?

If it's the mysql client, check the server's mysql and system/auth logs.  The mysql instance might not be configured to allow this type of connection/authentication from the user.

Reply all
Reply to author
Forward
0 new messages