Inside an Ubuntu server, I have my codebase for my flask CRUD app as well as a mysql database
Here’s the code I am running to integrate the database to my flask app:
from flask_mysqldb import MySQL
app.config[‘MYSQL_HOST’] = ‘localhost’
app.config[‘MYSQL_USER’] = ‘root’
app.config[‘MYSQL_PASSWORD’] = ‘new_password’
app.config[‘MYSQL_DB’] = ‘crud’
mysql = MySQL(app)
When I try to run, the app locally on the ubuntu server, using the line python3 flaskappmysql.py, there seems to be no problem AT ALL.
However, when I access it thru the hosted IP address 172.xx.xxx.xxx, I get this kind of error:
MySQLdb.OperationalError: (1045, “Access denied for user ‘root’@’localhost’ (using password: NO)”)
What do I need to do to fix this problem? I am a sure I provided correct mysql credentials and can’t seem to diagnose what’s wrong.
lawlietlawliet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.