Hi,
I'm using Flask. I'm getting mysql connection error. All parameters seem to be right. What could be the problem?
class Config(object):
...
SQLALCHEMY_DATABASE_URI = "mysql+mysqlconnector://{username}:{password}@{hostname}/{databasename}?charset=utf8".format(
username="<my_username>",
password="<my_password",
hostname="<my_username>.mysql.pythonanywhere-services.com",
databasename="<my_username>$my_new_database")
SQLALCHEMY_TRACK_MODIFICATIONS = False
config = Config()
app = Flask(__name__)
app.config.from_object(config)
The error I get is:
Error running WSGI application
2023-05-11 14:18:32,690: sqlalchemy.exc.DatabaseError: (mysql.connector.errors.DatabaseError) 2003
(HY000): Can't connect to MySQL server on 'localhost:3306' (111)
2023-05-11 14:18:32,690: (Background on this error at: https://sqlalche.me/e/20/4xp6)
What am I missing?