Python连接mysql出错,_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

时间:2021-06-30 19:14:26

Python连接mysql出错,_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

通过mysql -uroot -p123456 -h localhost

Python连接mysql出错,_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

Python连接mysql出错,_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

解决方法:

由上可知,是否可以将export DATABASE_URL=mysql://root:123456@127.0.0.1/blog_mini

改成export DATABASE_URL=mysql://root:123456@localhost/blog_mini

Python连接mysql出错,_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

 

或者执行

GRANT ALL PRIVILEGES on *.* to 'root'@'127.0.0.1' identified by 'thinkive';
flush privileges

Python连接mysql出错,_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

至此,问题解决