Suse中出错Access denied for user ''@'localhost' to&

  好久没有用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!

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。