MySQL 的 root 密碼,可以透過以下方法重新設定:

1. 停止 MySQL server。

# /etc/init.d/mysql stop

2. 啟動 MySQL server,並加上 –skip-grant-tables 參數,便可以略過輸入密碼的過程:

# mysqld_safe --skip-grant-tables --user=root &

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 即可。

# /etc/init.d/mysqld restart 

arrow
arrow
    全站熱搜

    yuic123 發表在 痞客邦 留言(0) 人氣()