Migrating from sqlite to mysql - SQLalchemy

Avi Baruch :

I recently tried to migrate a flask site using a SQLite db connected to using SQLalchemy. I am migrating to Pythonanywhere and I want to change to a mySQl db. I used this code to connect to the db:

mysql+mysqldb://USERNAME:[email protected]/news

obviously I replace USERNAME and PASSWORD with the necessary values. I get this error:

sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1044, "Access denied for user 'USERNAME'@'%' to database 'news'") (Background on this error at: http://sqlalche.me/e/e3q8)

please help, I'm not sure what to do at this point. Thank you

KJTHoward :

Been playing around with my own account on Pythonanywhere and figured it out. The database name is username$dbname so your connection string should be:

mysql+mysqldb://USERNAME:[email protected]/USERNAME$news

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=23716&siteId=1