mysql5.x忘記密碼
參考:https://blog.csdn.net/qq_34102150/article/details/1261200561、停止MySQL服務,輸入 net stop mysql 停止服務。
2、切換到MySQL的bin文件下,
mysql5.x: mysqld --console --skip-grant-tables --shared-memory
mysqld --console --skip-grant-tables --shared-memory
mysqld --console --skip-grant-tables --shared-memory
3、輸入mysql -uroot -p回車,不用輸入密碼,直接按回車跳過,
輸入: use mysql
輸入: update user set password=PASSWORD('123456') where USER='root';
或者: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
輸入: FLUSH PRIVILEGES;
或者: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
輸入: FLUSH PRIVILEGES;
4、重啟服務
posted @ 2024-02-17 15:09 半導體 閱讀(45) | 評論 (0) | 編輯 收藏