这篇文章将为大家详细讲解有关mysql密码错误怎么办,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

mysql登录错误:

mysqladmin:connecttoserverat'localhost'failederror:'Accessdeniedforuser'root'@'localhost'(usingpassword:YES)'

解决方法:

#>servicemysqldstop#>mysqld_safe--skip-grant-tables&输入mysql-uroot-p回车进入>usemysql;>updateusersetpassword=PASSWORD("newpass")whereuser="root";更改密码为newpassord>flushprivileges;更新权限>quit退出servicemysqldrestartmysql-uroot-p新密码进入

二,忘记本地root的登录密码

解决过程:

1、编辑/etc/my.cnf

在[mysqld] 配置部分添加一行

skip-grant-tables

2、保存后重启mysql

[root@localhostetc]#servicemysqlrestartShuttingdownMySQL.[OK]StartingMySQL.[OK]

3、登录数据库重新设置root密码

[root@localhost~]#mysql-uroot-pmysqlEnterpassword:

直接回车进入。

关于mysql密码错误怎么办就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。