C:\Users\Administrator>net stop mysql MySQL服務正在中止. MySQL服務已成功中止。
2.打開命令行,切換到mysql的bin目錄下;html
C:\Users\Administrator>cd C:\Program Files\MySQL\MySQL Server5.5\bin C:\Program Files\MySQL\MySQL Server5.5\bin>
3.跳過登陸校驗 輸入:mysqld -nt --skip-grant-tables mysql
C:\Program Files\MySQL\MySQL Server5.5\bin>mysqld -nt --skip-grant-tables
回車確認後,若是沒有錯誤信息,窗口會掛起,不往下執行,保持該窗口不動。sql
C:\Users\Administrator>cd C:\Program Files\MySQL\MySQL Server5.5\bin
5.直接輸入:mysql 並回車,若是成功,將出現MySQL提示符 >數據庫
C:\Program Files\MySQL\MySQL Server5.5\bin>mysql Welcome to the MySQL monitor.Commandsendwith;or \g. YourMySQL connection id is1 Server version:5.5.35MySQLCommunityServer(GPL) Copyright(c)2000,2013,Oracleand/or its affiliates.All rights reserved. Oracleis a registered trademark of OracleCorporationand/or its affiliates.Other names may be trademarks of their respective owners. Type'help;'or'\h'for help.Type'\c' to clear the current input statement. mysql>
6.選擇要操做的數據庫,使用mysql數據庫windows
mysql>USE mysql;
7.能夠修改密碼了:工具
mysql>UPDATE mysql.user SET authentication_string=PASSWORD('123456') WHERE user='root';
8.刷新權限:ui
mysql>FLUSH PRIVILEGES;
9.退出:(退出的方法有多種:quit、exit、ctrl+c、\q 等); spa
mysql>select now(); 或者 mysql>show databases;
若是提示須要從新reset設置密碼,當前環境下,再次修改密碼:命令行
mysql>SET PASSWORD FOR 'root'@'localhost'= PASSWORD('123456');
12. 退出當前環境,從新登陸,確認是否OK!code
mysql>select now();