大龙的博客

常用链接

统计

最新评论

mysqladmin: connect to server at 'localhost' failed


[root@testlinux ~]# mysqladmin -u root password mysql
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user
'root'@'localhost' (using password: NO)'

出现这种提示表明无法修改密码...那究竟如何才能修改密码...

以下介绍的方法...修改roota密码....即使root密码忘了 也适用。。。。

step1:停止mysql服务

step2启动mysqld服务,加上--skip-grant-tables选项

step3:用root用户连接mysql(这时不用输入密码即可进入)

step4:为root用户设置新密码

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=PASSWORD("hello")where user="root";
Query OK, 3 rows affected (0.03 sec)
Rows matched: 3 Changed: 3 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
step5:重启mysql服务

OK...现在用root连接你会发现密码已经改过来了。。^_^

posted on 2009-08-26 15:06 大龙 阅读(8122) 评论(2)  编辑 收藏 引用

评论

# re: mysqladmin: connect to server at 'localhost' failed[未登录] 2011-04-26 15:15 李云

图片看不了呀怎么  回复  更多评论   

# re: mysqladmin: connect to server at 'localhost' failed 2012-06-26 15:04 家电维修

不错,学习了,就是图片没有显示出来。  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理