pymysql.err.OperationalError: (1045, "Access denied for user 'MYID'@'localhost' (using password: NO)") pymysql.err.OperationalError: (1045, "Access denied for user 'MYID'@'localhost' (using password: NO)") flask flask

pymysql.err.OperationalError: (1045, "Access denied for user 'MYID'@'localhost' (using password: NO)")


Using a mysql client or console you should execute something like this:

grant all privileges on DBNAME.* to MYID@localhost identified by 'MYPW';

using a user with grant privilege (usually root).

Of course you can narrow down the privileges that you grant from: all privileges to let's say: select,insert,update,delete, depending on the case.

To access the console with root open a terminal window and write:

mysql -uroot -p

and provide the password or for passwordless root:

mysql -uroot

In case you do not know the root password follow this guide: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

In case you are on a company/university workstation with no privileges to perform the above operation, ask from the administrator to grant the privileges.


try changing your

app.config['MYSQL_HOST'] = ...

to

app.config['MYSQL_DATABASE_HOST'] = ...

this applies to the rest as well:

MYSQL_DATABASE_HOST default is ‘localhost’MYSQL_DATABASE_PORT default is 3306MYSQL_DATABASE_USER default is NoneMYSQL_DATABASE_PASSWORD default is NoneMYSQL_DATABASE_DB   default is NoneMYSQL_DATABASE_CHARSET  default is ‘utf-8

I had the same problem but this fixed it for me. Hope this helps you as well.Look at the Flask MySQL reference here