Chinaunix首页 | 论坛 | 博客
  • 博客访问: 762295
  • 博文数量: 790
  • 博客积分: 40560
  • 博客等级: 大将
  • 技术积分: 5065
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-28 16:29
文章分类

全部博文(790)

文章存档

2011年(1)

2008年(789)

我的朋友

分类: LINUX

2008-08-28 17:15:37

 
我的系统是ubuntu6.06,最近新装好的mysql在进入mysql工具时,总是有错误提示:
#mysql-uroot-p
Enterpassword:
ERROR1045(28000):Accessdeniedforuser''root''@''localhost''(usingpassword:NO)

使用网上介绍的方法修改root用户的密码:
#mysqladmin-uroot-ppassword''newpassword''
Enterpassword:
mysqladmin:connecttoserverat''localhost''failed
error:''Accessdeniedforuser''root''@''localhost''(usingpassword:YES)''

现在终于被我找到了解决方法,如下(请先测试方法三,谢谢!):

方法一:
#/etc/init.d/mysqlstop
#mysqld_safe--user=mysql--skip-grant-tables--skip-networking&
#mysql-urootmysql
mysql>UPDATEuserSETPassword=PASSWORD(''newpassword'')whereUSER=''root'';
mysql>FLUSHPRIVILEGES;
mysql>quit

#/etc/init.d/mysqlrestart
#mysql-uroot-p
Enterpassword:<输入新设的密码newpassword>

mysql>

方法二:
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
#mysql-udebian-sys-maint-p
Enterpassword:<输入[client]节的密码>
mysql>UPDATEuserSETPassword=PASSWORD(''newpassword'')whereUSER=''root'';
mysql>FLUSHPRIVILEGES;
mysql>quit

#mysql-uroot-p
Enterpassword:<输入新设的密码newpassword>

mysql>

方法三:
这种方法我没有进行过测试,因为我的root用户默认密码已经被我修改过了,那位有空测试一下,把结果告诉我,谢谢!
#mysql-uroot-p
Enterpassword:<输入/etc/mysql/debian.cnf文件中[client]节提供的密码>

至此,困惑多时的问题解决了!

阅读(602) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~