破解本地的mysql用戶名和密碼
Windows: 1.用系統管理員登陸系統。 2.停止MySQL的服務。 3.進入命令窗口,然后進入MySQL的安裝目錄,比如我的安裝目錄是c:\mysql,進入C:\mysql\bin 4.跳過權限檢查啟動MySQL, c:\mysql\bin>mysqld-nt --skip-grant-tables 5.重新打開一個窗口,進入c:\mysql\bin目錄,設置root的新密碼 c:\mysql\bin>mysqladmin -u root flush-privileges password "newpassword" c:\mysql\bin>mysqladmin -u root -p shutdown 將newpassword替換為你要用的root的密碼,第二個命令會提示你輸入新密碼,重復第一個命令輸入的密碼。 6.停止MySQL Server,用正常模式啟動Mysql 7.你可以用新的密碼鏈接到Mysql了。 Unix&Linux: 1.用root或者運行mysqld的用戶登錄系統; 2.利用kill命令結束掉mysqld的進程; 3.使用--skip-grant-tables參數啟動MySQL Server shell>mysqld_safe --skip-grant-tables & 4.為root@localhost設置新密碼 shell>mysqladmin -u root flush-privileges password "newpassword"5.重啟MySQL Server |