[Solved] pymysql.err.OperationalError: (1045, “Access denied for user ‘root‘@‘‘

Error: pymysql.err OperationalError: (1045, “Access denied for user ‘root’@‘’ (using password: YES)”)

Possible problems:
1. Firewall blocking,
Solution: log in to the server and turn off the firewall

systemctl stop firewalld.service

2. User empowerment (the root user I use here)
Solution: log in to the MySQL database for empowerment

grant all privileges on *.* to 'root'@'%' identified by 'password';
flush privileges;

3. Check whether the password is entered incorrectly

Read More: