Reputation: 39
I connect mysql with pymysql. but below error raise
pymysql.connect(host='localhost', user='root', password="pass", db='db_name', charset='utf8', port=3306)
pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")
So I check my root password. But Through "mysql -u root -p" I login in mysql. and I execute "grant all privileges on [db_name] to root@localhost;". but it's same. Also i execute "grant all privileges on [db_name] to root@localhost identified by "Password". but error raise "
error : "ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'password'' at line 1
Upvotes: 0
Views: 7559
Reputation: 461
What version of MySQL are you using? I was not able to use PyMySQL with MySQL 8, so I had to downgrade to 5.4.
EDIT: Here's my thread on troubleshooting and ultimately resolving: PyMySQL Access Denied "using password (no") but using password
Upvotes: 0