How to Reset the Root Password of MySQL?

 

剛剛突然發現我上午裝 MyDNS 時不小心把連線帳號的權限都給拿掉了 XD
更糟糕的是,root 的密碼我也搞丟了…

還好有找到這篇:B.1.4.1. How to Reset the Root Password

  1. 停止 MySQL Server
  2. 將下列文字建立為單行的純文字檔案

    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword');
  3. 使用 –init-file 參數重新啟動 MySQL
    mysqld_safe –init-file=剛剛建立的檔案

  4. 登入後再更改密碼

差點就嗚呼哀哉了

Technorati Tags: , ,

回首過往今日

相關文章

No Comments yet »

本篇文章的迴響 RSS 訂閱。 TrackBack URI

發表迴響

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.