MySQLdb._exceptions.OperationalError:(1698,“拒绝用户'root'@'localhost'的访问)

2024-05-15 21:32:37 发布

您现在位置:Python中文网/ 问答频道 /正文

当我运行SQLPython脚本时,出现了以下错误

MySQLdb._exceptions.OperationalError: (1698, "Access denied for user 'root'@'localhost'")
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1698, "Access denied for user 'root'@'localhost'")
(Background on this error at: http://sqlalche.me/e/13/e3q8)

我查看了mysql.user表,得到以下结果:

+------------------+-----------+-----------------------+
| User             | Host      | plugin                |
+------------------+-----------+-----------------------+
| debian-sys-maint | localhost | caching_sha2_password |
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session    | localhost | caching_sha2_password |
| mysql.sys        | localhost | caching_sha2_password |
| root             | localhost | auth_socket           |
+------------------+-----------+-----------------------+

Tags: localhostforaccesssysmysqlrootpasswordcaching