保護剛裝好的MySQL 4.1

Home Home
引用 | 編輯 cchliu
2007-02-15 14:20
樓主
推文 x0
# mysql -u root
Welcome to the MySQL monitor. ...

如果 root 帳號有設密碼保護的話,上面這個指令就無法執行成功,您必須加上 -p 還項,並輸入 root 密碼才能登入:

# mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor. ...

# use mysql


    [*] 為 root 設定密碼

    # update user set password = PASSWORD('新密碼') where user='root' (PHP5支援)

    # update user set password = OLD_PASSWORD('新密碼') where user='root' (PHP4支援)


    [*] 將 root 換成其他名稱

    # update user set user='myroot' where user='root'

    [*] 刪除匿名使用者

    # delete from user where user=''

    [*] 處理能從各處登入的使用者

    # update user set host='%.sol' where host = '%'

    上想指令會讓所有使用者只能從區域網路內登入(這個例子的區網網域名稱為sol)



最後您必須執行 FLUSH PRIVILEGES ,這些設定才會生效。

獻花 x0