如何解决MySQL 错误 1045:用户 'root'@'localhost' 的访问被拒绝使用密码:YES
我在 Windows 上安装 MysqL Workbench 8.0.22。但是我无法成功连接。我应该怎么做才能更正这个问题?虽然我输入了正确的密码,但我得到了用户'root'@'localhost'的访问被拒绝(使用密码:YES ) 并且无法进行数据库连接。请帮我。到目前为止,我所做的是,
-
%AppData%\MysqL
-
然后我按照以下步骤重置 root 密码: Resetting the Root Password: Windows Systems
在我运行这个命令之后
MysqLd --defaults-file="C:\\ProgramData\\MysqL\\MysqL Server 8.0\\my.ini" --init-file=C:\\MysqL-init.txt --console
在 CMD(以管理员身份运行)我得到:
2021-07-23T09:36:09.763074Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE','NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2021-07-23T09:36:09.764268Z 0 [System] [MY-010116] [Server] C:\Program Files\MysqL\MysqL Server 8.0\bin\MysqLd.exe (MysqLd 8.0.22) starting as process 8892
2021-07-23T09:36:09.765503Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3,but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-07-23T09:36:09.765528Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_unicode_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2021-07-23T09:36:09.835697Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-23T09:36:12.223043Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-07-23T09:36:13.527018Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
2021-07-23T09:36:13.756941Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2021-07-23T09:36:13.773592Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2021-07-23T09:36:14.104612Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-07-23T09:36:14.106154Z 0 [System] [MY-013602] [Server] Channel MysqL_main configured to support TLS. Encrypted connections are Now supported for this channel.
2021-07-23T09:36:14.174295Z 0 [Warning] [MY-010319] [Server] Found invalid password for user: 'root@localhost'; Ignoring user
2021-07-23T09:36:14.276943Z 7 [Warning] [MY-010319] [Server] Found invalid password for user: 'root@localhost'; Ignoring user
2021-07-23T09:36:14.278797Z 7 [ERROR] [MY-000061] [Server] 1396 Operation ALTER USER Failed for 'root'@'localhost'.
2021-07-23T09:36:14.284169Z 0 [System] [MY-010931] [Server] C:\Program Files\MysqL\MysqL Server 8.0\bin\MysqLd.exe: ready for connections. Version: '8.0.22' socket: '' port: 3306 MysqL Community Server - GPL.
当我双击我的数据库连接时:
然后我删除了所有连接,
并尝试创建一个新连接并单击“测试连接”按钮:
- 我尝试过 MysqL Shell:
当我运行此命令时,输入 root 用户的密码:
\connect root@localhost
Creating a session to 'root@localhost'<br />
Please provide the password for 'root@localhost': **** <br />
MysqL Error 1045: Access denied for user 'root'@'localhost' (using password: YES)
- 我尝试了 CMD:
MysqLd --skip-grant-tables
2021-07-23T09:46:44.161756Z 0 [System] [MY-010116] [Server] C:\Program Files\MysqL\MysqL Server 8.0\bin\MysqLd.exe (MysqLd 8.0.22) starting as process 14700
2021-07-23T09:46:44.168273Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MysqL\MysqL Server 8.0\data\MysqLd_tmp_file_case_insensitive_test.lower-test
2021-07-23T09:46:44.168472Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MysqL\MysqL Server 8.0\data\MysqLd_tmp_file_case_insensitive_test.lower-test
2021-07-23T09:46:44.172258Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\Program Files\MysqL\MysqL Server 8.0\data\' (OS errno: 2 - No such file or directory)
2021-07-23T09:46:44.173769Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-07-23T09:46:44.173965Z 0 [System] [MY-010910] [Server] C:\Program Files\MysqL\MysqL Server 8.0\bin\MysqLd.exe: Shutdown complete (MysqLd 8.0.22) MysqL Community Server - GPL.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
然后我打开CMD终端,以管理员身份运行,输入以下命令观察我的MysqL端口状态(3306):
netstat -a -b
TCP [::]:3306 DESKTOP-MY:0 LISTENING
[MysqLd.exe]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。