我的系统是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) |