bestlong 怕失憶論壇

標題: 當 MySQL 忘記管理密碼的解決方法(Linux 版) [打印本頁]

作者: bestlong    時間: 2006-8-8 09:29     標題: 當 MySQL 忘記管理密碼的解決方法(Linux 版)

如果 MySQL 正在運作,請先關閉,關閉方法:

service mysqld stop



killall -TERM mysqld

接下來,重新開啟 MySQL,請額外加上指令:

/usr/bin/safe_mysqld --skip-grant-tables &
(請注意執行程式的路徑,請替換成你的程式路徑)

再來就是進入 MySQL:

# mysql (這個也是,如果直接執行找不到程式,請打完整路徑)
>use mysql
>update user set password=password("新密碼") where user="root";
>flush privileges;
>exit;

關閉現在執行的 MySQL,重新正常啟動 MySQL。

若是碰到新版 MySQL 的密碼演算法不同,可用下列方式改密碼
>update user set password=old_password("新密碼") where user="root";




歡迎光臨 bestlong 怕失憶論壇 (http://www.bestlong.idv.tw/) Powered by Discuz! X1.5