mysql登录报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
在MySQL登录时出现Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问


对于出现拒绝访问root用户的解决方案
错误1045(28000):用户'root'@'localhost'(使用密码:YES)拒绝访问
首先解析此英文:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES);
解析的地方有两处:1.Access denied(拒绝访问);2.using password:NO/YES
一、出现access denied的原因有如下可能:
1)mysql的服务器停止:
若MySQL已经没有启动,重启MySQL服务器:systemctl restart mysqld
2)用户的端口号或者IP导致:
若用户的端口号与IP(3306/3307)不一致,打开my.ini文件进行编辑。全部编辑替换为: port=X
3)mysql的配置文件错误----my.ini等文件:
my.ini文件误输入无效内容,不知道到何处。复制替换该文件;有人已经对my.ini文件进行解释以及注释:https://blog.csdn.net/lienfeng6/article/details/78140404
4)root用户的密码错误(后面解决)
二、出现 using password的原因如下:
不输入密码:

错误的密码:

解决方案:
vim /etc/my.cnf文件;
在[mysqld]后添加skip-grant-tables(登录时跳过权限检查)
重启MySQL服务:sudo systemctl restart mysqld

修改密码


登录mysql,输入mysql –uroot –p;直接回车(Enter)

输入:set password for ‘root’@‘localhost’=password(‘Admin123@qwe’);
如果报:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
输入:flush privileges;

再次输入:set password for ‘root’@‘localhost’=password(‘Admin123@qwe’);

为避免麻烦,再次设置远程访问

退出:exit

再把my.ini的skip-grant-tables删除或者注释掉

重启MySQL:sudo systemctl restart mysqld

再次连接,成功

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)问题
问题描述: 在ubuntu14.04上安装完MYSQL后,MYSQL默认给分配了一个默认密码,但当自己在终端上使用默认密码登录的时候,总会提示一个授权失败的错误. 报错信息:Access denied ...
- centos7 上安装mysql5.7后登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Yes 或者No)
原文转载自以下链接:https://blog.csdn.net/keepd/article/details/77151006 安装完mysql后会有个临时密码去日志查看,但是查看登录修改密后还是不行 ...
- 升级到macOS 10.12 mysqlb报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
系统升级到macOS 10.12后启动mysql后,在终端输入mysql 报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' ...
- mysql安装在centos7报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
原文链接:http://blog.csdn.net/kuluzs/article/details/51924086 [问题]:mysql版本:5.7.13 首次在centos下安装MySQL,客户端连 ...
- 密码正确 mysql无法登陆 red7.3 上安装mysql5.6后登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passswd :yes)
集群需要mysql存储元数据,就在前几天还运行好好的,突然就进不去了......还是太菜,遇到的bug少. 引起这种故障的原因有很多......第一个坑比较多,大部分用户也就用第一个就可以解决问题,我 ...
- CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解决方法
1.停用mysql服务:# /etc/rc.d/init.d/mysqld stop 2.输入命令:# mysqld_safe --user=mysql --skip-grant-tables --s ...
- mac mysql连接报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
找了半天 又是kill进程,又是改设置文件,又是重启电脑,都不管用 翻到stackoverflow上的解决方案,实施成功: 原文链接:https://stackoverflow.com/questio ...
- Linux下登陆MySQL时遇到报错"RROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) "
前言 作者在2021-07-21时遇到 linux下登陆MySQL时遇到报错"RROR 1045 (28000): Access denied for user 'root'@'localh ...
- 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)) 修改: # ...
- 【转载】重置密码解决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 ...
随机推荐
- Javascript框架 - ExtJs - 类
类(ExtJs Class) preparation! 我用的是ext-4.2,解压后会得到以下文件 学习要用到的文件很少,现在保留以下文件和整个文件夹,然后删除其它文件并保持目录结构.本页面底部有提 ...
- launch 文件的写法
1. launch文件的写法 ❀标签 ☺<node> 启动一个节点 ☺ <param> 设置参数服务器的参数 ☺ < ...
- VC操作excel
http://www.cnblogs.com/witxjp/archive/2010/06/05/1752181.html 最近在做个数据库程序,因为有些数据用户要求导出到Excel文件显示(需要 ...
- 链接器link.exe 编译器cl.exe 资源编译器rc.exe
原文地址:https://blog.csdn.net/biggbang/article/details/24433065 1.cl.exe文件是Visual C\C++的编译器,它将程序源代码文件编译 ...
- 子元素position:absolute定位之后脱离文档流,怎么使子元素撑开父元素
纯粹的CSS无法实现.因为position:absolute就是脱离文档流,怎么能让父元素不塌陷呢? 目前想到的只能用js和jquery来实现了,用js获取子元素的高度,赋值给父元素. <!DO ...
- Android-创建一个简单的用户接口-(补day2内容)
如果按照之前的布局设置,那么输入框和按钮组件的大小就会是刚好满足它们的内容的.如图1. 图1.输入框和按钮宽度设置为”wrap_content” 这样的设置是可以满足按钮的,但不能满足输入框的要求,因 ...
- 关于flock
昨天在研究dropbear实现时,看到初始化脚本/etc/init.d/dropbear中有关于文件锁lock的内容,如下: lock /tmp/.switch2jffs mkdir -p /e ...
- lua io.read()
io.read(...) 从文件中读取内容,还有另外一种写法就是 file:read() 后面可以跟的读取方式有: (1) "n" 读取一个数字,这是唯一一个返回数字而不是字符串 ...
- Kendo ui 入门知识点
1. Kendo的继承 varPerson= kendo.Class.extend({...}); var person = new person(); var Parent = kendo.Clas ...
- springboot:SunCertPathBuilderException: unable to find valid certification path to requested target
有次创建springboot工程时报错,在之前是没有问题的.见下: 出现这种情况,有时在URL最后加一个反斜杠就可以了,但是这次不行,加了也没有用. 后来把URL改成了:http://start.sp ...