Windows平臺下MYSQL破解root密碼(忘記root密碼的解決方法)
1、停止MYSQL服務(wù),開始→運(yùn)行→CMD打開DOS窗口,輸入 net stop mysql
C:/Documents and Settings/skate_db>net stop mysql MySQL 服務(wù)正在停止. MySQL 服務(wù)已成功停止。
2、在開始→運(yùn)行→CMD命令行窗口,進(jìn)入MYSQL安裝目錄
C:/Documents and Settings/skate_db>cd C:/Program Files/MySQL/MySQL Server 5.0/bin
3、進(jìn)入mysql安全模式,即當(dāng)mysql起來后,不用輸入密碼就能進(jìn)入數(shù)據(jù)庫。
C:/Program Files/MySQL/MySQL Server 5.0/bin>mysqld-nt --skip-grant-tables 100423 10:27:27 [Warning] Changed limits: max_open_files: 2048 max_connections: 800 table_cache: 619
4、重新打開一個開始→運(yùn)行→CMD命令行窗口,輸入mysql –u root -p,使用空密碼的方式登錄MySQL(不用輸入密碼,直接按回車)
C:/Documents and Settings/skate_db>mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or /g. Your MySQL connection id is 1 to server version: 5.0.22-community-nt Type 'help;' or '/h' for help. Type '/c' to clear the buffer. mysql>
5、輸入以下命令開始修改root用戶的密碼(注意:命令中mysql.user中間有個“點(diǎn)”)
命令:mysql> update mysql.user set password=PASSWORD('新密碼') where User='root';
mysql> update mysql.user set password=password('root') where user='root'; Query OK, 2 rows affected (0.06 sec) Rows matched: 2 Changed: 2 Warnings: 0
6、保存配置,刷新權(quán)限表
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql>
7、退出
mysql> quit
這樣MYSQL超級管理員賬號ROOT已經(jīng)重新設(shè)置好了,因?yàn)樾脑趍ysql還是運(yùn)行在安全模式下,所以在windows的任務(wù)管理器里kill掉mysql-nt.exe 這個進(jìn)程,重新啟動mysql,用新設(shè)置的root密碼登錄。
C:/Documents and Settings/skate_db>net start mysql MySQL 服務(wù)已經(jīng)啟動成功。 C:/Documents and Settings/skate_db>mysql -u root -p Enter password: **** Welcome to the MySQL monitor. Commands end with ; or /g. Your MySQL connection id is 2 to server version: 5.0.22-community-nt Type 'help;' or '/h' for help. Type '/c' to clear the buffer. mysql> -----end-----