在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)的更多相关文章

  1. 解决mysql登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)问题

    问题描述: 在ubuntu14.04上安装完MYSQL后,MYSQL默认给分配了一个默认密码,但当自己在终端上使用默认密码登录的时候,总会提示一个授权失败的错误. 报错信息:Access denied ...

  2. 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后会有个临时密码去日志查看,但是查看登录修改密后还是不行 ...

  3. 升级到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' ...

  4. 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,客户端连 ...

  5. 密码正确 mysql无法登陆 red7.3 上安装mysql5.6后登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passswd :yes)

    集群需要mysql存储元数据,就在前几天还运行好好的,突然就进不去了......还是太菜,遇到的bug少. 引起这种故障的原因有很多......第一个坑比较多,大部分用户也就用第一个就可以解决问题,我 ...

  6. 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 ...

  7. mac mysql连接报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    找了半天 又是kill进程,又是改设置文件,又是重启电脑,都不管用 翻到stackoverflow上的解决方案,实施成功: 原文链接:https://stackoverflow.com/questio ...

  8. 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 ...

  9. 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)) 修改: # ...

  10. 【转载】重置密码解决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 ...

随机推荐

  1. Python pipenv

    pipenv都包含什么? pipenv 是 Pipfile 主要倡导者.requests 作者 Kenneth Reitz 写的一个命令行工具,主要包含了Pipfile.pip.click.reque ...

  2. icon图标制作网站推荐

    推荐链接 easyicon

  3. react-踩坑记录——iconfont

    选取图标,添加至购物车后,下载代码. 后将下载了的文件夹改名,放入css文件夹中.在组件中使用到的时候按路径引入“iconfont.css”文件即可. 使用

  4. Ajax——从服务器获取各种文件

    ajax.js内容 function ajax(url,fnWin,fnFaild){ //1.创建ajax对象 var xhr = window.XMLHttpRequest ? new XMLHt ...

  5. I - Magic FZU - 2280 (字符串hash)

    题目链接: I - Magic FZU - 2280 学习链接: FZU - 2280 I - Magic 题目大意: 给你nn个字符串,每个字符串有一个值ww,有qq次询问,一共两种操作:一是“1, ...

  6. redis-LinkedList

    1.redis-LinkedList[重点] Java List :  数组ArrayList 链表LinkedList 为什么redis选取了链表? Redis操作中,最多的操作是进行元素的增删 使 ...

  7. nginx+supervisor+gunicorn+flask

    一. 更新系统 #yum -y install epel-release #yum clean all && yum makecache #yum -y update 二.安装pyth ...

  8. NAND Flash底层原理,SLC MLC TLC比较【转】

    转自:https://blog.csdn.net/qq_39560607/article/details/81714145 版权声明:请注明转载自Christa_RJ https://blog.csd ...

  9. whistle工具全程入门

    接触过前后端开发的同学应该都了解网络请求代理工具fiddler(mac下面常用的是Charles),可以用来拦截分析请求.包装请求.本地调试和移动端代理开发调试等.多多少少,fiddler和Charl ...

  10. Git学习笔记05-撤销修改

    使用 git checkout -- file可以撤销工作区的修改 一种是修改后还没有放到暂存区,撤销修改回到和版本库一模一样的状态 lesson.txt文件已经提交到版本库了,内容如图. ​ 修改一 ...