MySQL_ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)_重置root密碼
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
(using password: NO) 表示嘗試連接時沒有提供密碼。
(using password: YES) 表示嘗試連接時提供了密碼。
我這邊起初密碼是rootroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
表示我們嘗試以root用戶連接MySQL資料庫時提供的密碼不正確。
重置root密碼
Step1.開啟Windows「服務」管理工具(可以在開始菜單中搜索「services.msc」),找到MySQL服務,並停止它。
以下是介面方式:
當你關閉MySQL服務後,3306服務此時就沒有相關服務在使用了。
內容如下
ALTER USER 'root'@'localhost' IDENTIFIED BY '你想更換的新密碼';
Step3.用cmd並以系統管理員來啟動
下以下指令
mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --init-file="C:\\mysql-init.txt" --console
Step4.另外去開Command Line Client確認是否可用新密碼登入
Ref:
How to start MySQL with --skip-grant-tables?
How to restart MySQL with --skip-grant-tables if you can't use the root password?
忘记mysql root用户密码的解决办法(skip-grant-tables)
mysql--慎用--skip-grant-tables命令--忘记用户名密码(Linux環境)
MySQL --skip-grant-tables 選項關閉(Linux環境)
How to Reset MySQL Root Password on Windows [WORKING!!]
https://www.youtube.com/watch?v=V8_fpBE9deA&ab_channel=CSCORNERSunitaRai
留言
張貼留言