简体   繁体   中英

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

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?

I figured out the issue.

The issue was the http.network connect policy was disabled for apache and it worked when we enabled it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM