![Board logo](images/Artery_Green/logo.gif)
標題: [技巧] 忘記 MySQL 的 root 密碼可以這樣做... [打印本頁]
作者: adj 時間: 2007-11-29 18:07 標題: 忘記 MySQL 的 root 密碼可以這樣做...
如果忘記了 MySQL 的 root 密碼,可以透過以下方法重新設定:
1. 停止 MySQL server。
# /etc/init.d/mysql stop
2. 啟動 MySQL server,並加上 –skip-grant-tables 參數,便可以略過輸入密碼的過程:
# mysqld -u root --skip-grant-tables & mysql
3. 用 root 連接到 MySQL server,輸入:
mysql -u root
4. 進入 MySQL server 後,輸入以下幾行 SQL 語句:
mysql> use mysql;
mysql> update user set password=PASSWORD("newpass") where User=’root’;
mysql> flush privileges;
mysql> quit
5. 重新啟動 MySQL 即可。
歡迎光臨 ADJ網路實驗室 (http://dz.adj.idv.tw/) |
Powered by Discuz! 6.0.0 |