第一種 1.1停止MySQL服務 1.2以管理員身份運行cmd,執行以下命令
cd C:/PRogram Files/mysql-5.7.17-winx64/binmysqld --skip-grant-tables1.3在不關閉cmd情況下重新以管理員身份運行一個cmd,執行如下命令
cd C:/Program Files/mysql-5.7.17-winx64/binmysql -uroot -palter user 'root'@'localhost' identified by '123456';flush privileges;注:123456是設置root的新密碼,C:/Program Files/mysql-5.7.17-winx64/bin是mysql的地址
第二種 2.1MySQL配置文件my.ini中,在[mysqld]下添加skip-grant-tables 2.2重啟MySQL服務 2.3用管理員身份進入cmd,輸入如下命令
cd C:/Program Files/mysql-5.7.17-winx64/bin;flush privileges;alter user 'root'@'localhost' identified by '123456';注:123456是設置root的新密碼
新聞熱點
疑難解答