在Linux下 MySQL错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决办法【很管用】
一般这个错误是由密码错误引起,解决的办法自然就是重置密码。
假设我们使用的是root账户。
1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下:
#vim /etc/my.cnf(注:windows下修改的是my.ini)
在文档内搜索mysqld定位到[mysqld]文本段:
/mysqld(在vim编辑状态下直接输入该命令可搜索文本内容)
在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程,如下图所示:

保存文档并退出:
#:wq
2.接下来我们需要重启MySQL:
/etc/init.d/mysql restart(有些用户可能需要使用/etc/init.d/mysqld restart)

3.重启之后输入#mysql即可进入mysql。

4.接下来就是用sql来修改root的密码
mysql> use mysql;
mysql> update user set password=password("你的新密码") where user="root";
mysql> flush privileges;
mysql> quit
到这里root账户就已经重置成新的密码了。
5.编辑my.cnf,去掉刚才添加的内容,然后重启MySQL。大功告成!

网上有很多关于这个问题的解决说明,很多刚接触的朋友可能比较迷惑的是在自己的平台上找不到my.cnf或者my.ini文件,如果你是Linux,使用如下方式可以搜索到:
至于windows平台,去安装目录下找一下my.ini吧。
转自http://www.cnblogs.com/gumuzi/p/5711495.html
亲测管用;亲测管用;
感恩~~~
在Linux下 MySQL错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决办法【很管用】的更多相关文章
- Ubuntu下 MySQL的“ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)”
今天闲来无事,在Ubuntu上掏鼓一下mysql.但尴尬的是,当我输入mysql -u root -p的时候,抛出了一个错误:ERROR 1045 (28000): Access denied for ...
- ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)解决办法
问题:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 很久没用这台电脑的mysql ...
- 解决Linux下MySQL登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor)问题
两种方案: 一: 1.修改mysql配置文件:vim /etc/my.cnf 2.找到[mysqld]下添加 skip-grant-tables 配置 3.重启服务service mysqld res ...
- 【转载】重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor ...
- 转: windows系统下mysql出现Error 1045(28000) Access Denied for user 'root'@'localhost'
windows系统下mysql出现Error 1045(28000) Access Denied for user 'root'@'localhost' 转自 http://zxy5241.space ...
- Mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Linux: MyS ...
- 重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
出现报错: Warning: World-writable config file '/etc/my.cnf' is ignored // 该文件权限过高ERROR 1045 (28000): Acc ...
- 解决mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO/YES)
一.问题 有时候我们登录Mysql输入密码的时候,会出现这种情况 mysql -u root -p Enter Password > '密码' 错误:ERROR 1045 (28000): Ac ...
- 【MySQL】ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
问题现象: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问root用户 ...
随机推荐
- JuJu团队12月27号工作汇报
JuJu团队12月27号工作汇报 JuJu Scrum 团队成员 今日工作 剩余任务 困难 飞飞 完成data processing 待安排 无 婷婷 调试代码 提升acc 无 恩升 修正eval ...
- XV6源代码阅读-文件系统
Exercise1 源代码阅读 文件系统部分 buf.h fcntl.h stat.h fs.h file.h ide.c bio.c log.c fs.c file.c sysfile.c exec ...
- AJAX的get表单请求方式简述
一般在页面中常用在表单的操作中,请求数据, action : 数据提交的地址,默认是当前页面 method : 数据提交的方式,默认是get方式 get: 把数据名称和数据值用=连接,如果有多个的话, ...
- 最小生成树的两种方法(Kruskal算法和Prim算法)
关于图的几个概念定义: 连通图:在无向图中,若任意两个顶点vivi与vjvj都有路径相通,则称该无向图为连通图. 强连通图:在有向图中,若任意两个顶点vivi与vjvj都有路径相通,则称该有向图为强连 ...
- PL/SQL 找到某列都为空的列名
DECLARE CURSOR temp IS SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS WHERE TABLE_NAME=Upper('xxx'); v_num ...
- mysql DDL语言
- Quartus设计FIR滤波器的系数文件格式(适用于FIR II的IP核)
对常用的FIR,我们使用MATLAB的fdatool(或者filterDesigner) 设计滤波器,给定指标,生成系数.为了方便,我们将系数保存到文件,其保存格式比较简介,在此进行说明. 1.FIR ...
- supervisor的介绍
1.supervisor 简介 Supervisor 是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统.它可以很方便的 ...
- python进行md5加密的两种方法
本文转自:https://www.cnblogs.com/zknublx/p/6212590.html 一. 使用md5包 import md5 src = 'this is a md5 test.' ...
- 配置thinkphp对mysql线上线下切换不同环境的配置 - (mysql-thinkphp) (1)
1.先打印出配置项的信息,在Index控制器下面的index->index里面设置 namespace app\index\controller; class Index { public fu ...