0
votes

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

1
Did you make the accounts and database already in the databases tab on pythonanywhere? Also if you didn't know Pythonanywhere has a forum which the owners of the site check daily so they might be able to help you better. - KJTHoward
yeah, I did make the database and copied it directly from the database page. and ty - Avi Baruch

1 Answers

4
votes

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