Re: [SQL ] 最高權限下修改其他使用者的密碼

看板Database作者 (想買xperia TX ~)時間12年前 (2013/03/23 19:34), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《sunnyboy1030 (桑尼(Sunny))》之銘言: : 如題,想請問高手,如果我在root的帳號底下, : 想要修改其他使用者的密碼,這樣指令應該如何下達? : use mysql; : UPDATE user SET password=password('新密碼') where user='欲修改的帳號';  : FLUSH PRIVILEGES; : 我是這樣下達指令的,可是卻沒辦法修改成功。 : 請問問題出在哪裡呢? : 錯誤 : SQL 語法: :   FLUSH PRIVILEGES ; : MySQL 傳回: : #1064 - You have an error in your SQL syntax; check the manual that : corresponds to your MySQL server version for the right syntax to : use near 'FLUSH PRIVILEGES' at line 1 錯誤訊息指出是FLUSH PRIVILEGES的問題,但看起來OK沒打錯。 唯一想到的可能性, 是您執行flush的帳號並沒有RELOAD權限 (這必須實際看到user table才能確認, 在網路上是猜不出來的) http://dev.mysql.com/doc/refman/5.0/en/flush.html The FLUSH statement has several variant forms that clear or reload various internal caches, flush tables, or acquire locks. To execute FLUSH, you must have the RELOAD privilege. 承上, 確認的方式可以登入時 SHOW PRIVILEGES ; | Privilege | Context | Comment + (部份內容省略) | Reload | Server Admin | To reload or refresh tables, logs (略) 或是 USE mysql ; SELECT Host, User, Reload_priv FROM user ; 如果有RELOAD權限, 則Reload_priv欄為Y +-------------+------+-------------+ | Host | User | Reload_priv | +-------------+------+-------------+ | 127.0.0.1 | root | Y | | 192.168.1.2 | nina | N | +-------------+------+-------------+ 2 rows in set (0.00 sec) 請注意您當時登入的帳號, source IP必須吻合Host欄,帳號符合User欄。 ※ 編輯: justoncetime 來自: 122.116.53.137 (03/23 19:43)
文章代碼(AID): #1HJPDSqF (Database)
文章代碼(AID): #1HJPDSqF (Database)