When trying to connect to my local server (making a database entry - registration of a new user within a flask app) I'm getting the following error:
**_mysql_exceptions.OperationalError: (2059, <NULL>)**
Screenshot of the error Traceback
Here's MySQL import to Python:
from flask_mysqldb import MySQL
MySQL config:
# Config MySQL
app.config["MYSQL_DATABASE_HOST"] = "localhost"
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "<password_ph>"
app.config["MYSQL_DATABASE_DB"] = "myfirstdb"
app.config["MYSQL_DATABASE_CURSORCLASS"] = "DictCursor"
# init MYSQL
mysql = MySQL(app)
Here's usage of MySQL (The following code is within a registration function in Python)
# Create cursor
cur = mysql.connection.cursor()
# Execute query
cur.execute("INSERT INTO myfirstdb.firstflaskapp(name, email, username, password) VALUES(%s, %s, %s, %s)", (name, email, username, password))
# Commit to DB
mysql.connection.commit()
# Close connection
cur.close()
The error seems to pop up at the line with:
cur = mysql.connection.cursor()
Any idea what else might cause this error, please? Thanks a lot in advance