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 ...
随机推荐
- JAVA进阶1
间歇性混吃等死,持续性踌躇满志系列-------------第1天 1.冒泡排序法 import java.util.Arrays; public class SumNum{ public stati ...
- Redis 深度历险
学习资料 https://juejin.im/book/5afc2e5f6fb9a07a9b362527 包括下面几方面的内容 基础 应用 原理 集群 拓展 源码 to be done
- markdown自动生成侧边栏TOC /目录
http://blog.csdn.net/haleypku/article/details/51226704 此文可以只了解一下概念: http://i5ting.github.io/i5ting_z ...
- HashSet、TreeSet和LinkedHashSet分别基于HashMap、TreeMap和LinkedHashMap
1.如果你需要一个访问快速的Set,你应该使用HashSet: 当你需要一个排序的Set,你应该使用TreeSet: 当你需要记录下插入时的顺序时,你应该使用LinedHashSet. 2.因为Tre ...
- 一张图片资源要占用多大内存xhdpi xxhdpi
一张图片资源要占用多大内存,可以用下面的计算公式计算 4 * withPixel*(targetDensity /sourcedensity) * heightPixel*(targetDensity ...
- 嵌入式开发平台迅为iTOP-4412开发板-ssh常见问题以及解决方法
一.基本网络,软件安装以及配置 ssh 软件无法登陆 Ubuntu,有可能是网络不通.SSH 软件未安装.环境变量没配置.防 火墙未关闭等. 1. 网络连接 使用 ssh 传输文件的前提是网络顺畅,即 ...
- 20165234 《Java程序设计》第八周学习总结
第八周学习总结 教材内容学习 第十二章 Java 多线程机制 进程与线程 进程是程序的一次动态执行过程,对应了从代码加载.执行至执行完毕的一个完整过程. 线程不是进程,是比进程更小的执行单位. 一个进 ...
- git 上传代码
1.注册GitHub账号 2.在GitHub上建立github仓库 3.下载git 4.配置git 5.生成SSH密钥,并把密钥添加SSH密钥到GitHub上 6.创建本地仓库并上传代码到github ...
- 记录几个GIT命令
更新:git pull 删除未提交的文件:git clean -f 删除未提交的文件夹:git clean -fd 查看状态:git status 查看分支:git branch 检出某分支:git ...
- 【leetcode】557. Reverse Words in a String III
Algorithm [leetcode]557. Reverse Words in a String III https://leetcode.com/problems/reverse-words-i ...