大家好,又见面了,我是全栈君。
好久没实用MySQL了,上次由于装了Banq的论坛系统。在用MySQL Administrator进去的时候居然提示mysql error number 1045 access denied for user ‘admin’@’localhost’ (using password: YES)的错误,看来密码是对了,username错了。最后发现自己居然犯了个第几错误,username应该是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:
是昨日更新ROOTpassword时出错
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!
版权声明:本文博客原创文章,博客,未经同意,不得转载。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/117274.html原文链接:https://javaforall.cn