Suse中出錯Access denied for user ''@'localhost' to&,susedenied

來源:互聯網
上載者:User

Suse中出錯Access denied for user ''@'localhost' to&,susedenied

  好久沒有用MySQL了,上次因為裝了Banq的論壇系統,在用MySQL Administrator進去的時候竟然提示mysql error number 1045 access denied for user 'admin'@'localhost' (using password: YES)的錯誤,看來密碼是對了,使用者名稱錯了,最後發現自己竟然犯了個第幾錯誤,使用者名稱應該是root,唉!

  同時找了別人的資料,一起發上來,供下次使用。

  Access denied for user ''@'localhost' to database

  我在Suse Linux 10.2下用內建光碟片用Yast2安裝Mysql 5.0, 裝好後在終端輸入mysql, mysql

  成功啟動,退出,再輸入 mysqladmin -u root password XXXXX, 出現錯誤: mysqladmin: connect to server at 'localhost' failed

  error: 'Access denied for user 'root'@'localhost' (using password: NO)'

  如先輸入mysql,成功啟動後輸入use mysql,出現如下錯誤:Access denied for user ''@'localhost' to database 'mysql'

  還有,輸mysql可以,輸mysql -u root就出錯了:

  Access denied for user 'root'@'localhost' (using password: NO).

  The reason is:

  是昨日更新ROOT密碼時出錯

  update user set password = '123456' where user ="root" //這樣寫是錯的,密碼其實不是123456

  應該為update user set password = password ('123456') where user = "root"

  具體操作步驟:

  關閉mysql:

  # service mysqld stop

  然後:

  # mysqld_safe --skip-grant-tables

  啟動mysql:

  # service mysqld start

  mysql -u root

  mysql> use mysql

  mysql> UPDATE user SET Password=PASSWORD('xxx') WHERE user='root';

  mysql> flush privileges;

  mysql>\q

  That's it. I hope those above could do a little favor for you!

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.