Forums

SQLALCHEMY + FLASK Connection Error 2003 MySql

Hello, i'm getting this kind of error while trying to connect with my mysql database:

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'onlinedevvalere.mysql.pythonanywhere-services.com' (timed out)")

i use this inside my python code:

app.config['SQLALCHEMY_DATABASE_URI'] =  SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{username}:{password}@{hostname}/{databasename}'

Can someone help me?

Where are you running the code? You will not be able to connect to it from outside of PythonAnywhere as you're using a free account.