2014年3月28日 星期五

Set / Change / Reset the MySQL root password on Ubuntu Linux




Set / Change / Reset the MySQL root password on Ubuntu Linux


Tested on
- Ubuntu Linux 7.10 Gutsy Gibbon and MySQL 5.0.45. (2007-10-21)
- Ubuntu Linux 6.06 Dapper Drake and MySQL 4.1.15.

Set / change / reset the MySQL root password on Ubuntu Linux. Enter the following lines in your terminal.
  1. Stop the MySQL Server.
    sudo /etc/init.d/mysql stop

  2. Start the mysqld configuration.
    sudo mysqld --skip-grant-tables &

  3. Login to MySQL as root.
    mysql -u root mysql

  4. Replace YOURNEWPASSWORD with your new password!
    UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
Note: This method is not regarded as the securest way of resetting the password. However it works.


References

MySQL 5.0 Reference Manual: How to Reset the Root Password


沒有留言:

張貼留言

Welcome Moodler, 這個部落格, 我們會搜集我們常被詢問的問題; 歡迎留言.

精選文章

訓練計畫

小編最近聽了幾個人資單位或教育訓練部門的朋友喊累  (๑•́ ₃ •̀๑) 因為他們規劃了一系列的訓練課程,但要將這些線上訓練課程指派給學員時,需要進行多次的課程指派作業,才能將課程指派給所有應上課的同仁,既費時又費力,還要很仔細地核對名單,避免出錯  ╮(╯_╰)╭ ...