【问题记录】ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
一、问题描述
环境:MySQL 8.0 + Windows
由于密码错误或者其他原因导致无法连上MySQL服务,如下图:

二、解决方案
解决该问题的具体步骤如下:
1.关闭MySQL服务
以管理员权限运行cmd程序然后输入net stop mysql,或者运行services.msc 然后找到MySQL服务并停止运行;
2.跳过权限登录MySQL服务
看了很多人的博客,写的都是找到my.ini文件然后在[mysqld]后添加skip-grant-tables,经测试无效。
又查到有的说在cmd中运行mysqld –skip-grant-tables,实测在mysql8.0中已失效,现使用mysqld --console --skip-grant-tables --shared-memory,运行结果如下图:

3.无密登录
再打开一个cmd窗口,输入mysql -u root -p,然后回车,再回车(不输入密码),直接无密登录,如下图:

4.修改密码
修改密码所用的主要命令如下所示:
把密码设置为空:UPDATE mysql.user SET authentication_string='' WHERE user='root' and host='localhost';
查看USER表:select host,user,plugin,authentication_string from mysql.user;
以caching_sha2_password加密方式设置密码修改密码:ALTER user 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'root';
刷新:flush privileges;
5.重新登录
把之前打开的cmd窗口关闭,然后以管理员权限运行cmd程序,再执行net start mysql。在MySQL服务开启成功之后,输入mysql -u root -p然后在输入密码,成功登录MySQL。

【问题记录】ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)的更多相关文章
- mac系统中搭建apache+mysql+php的开发环境,安装mysql后,登录报错:mac ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
php新手在mac系统中搭建apache+mysql+php的开发环境(按照这篇博客来操作的:http://my.oschina.net/joanfen/blog/171109?fromerr=xvC ...
- Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因
在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...
- 升级到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 链接失败(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因为/tmp权限不足而导致ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)的解决方案
本机是centos 6.5 安装的mysql是5.1的版本. 在安装mysql之后,第一次启动mysql服务的时候,需要/tmp有777(rwxrwxrwx)的权限,然而楼主的/tmp是755(rw ...
- MySQL5.5出面ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)问题的解决办法
问题描述 安装完MySQL5.5数据库,使用Navicat Premium以及命令窗口连接数据库都报以下错误: ERROR 1045 (28000): Access denied for user ' ...
- MySQL学习笔记——ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Enter password: E ...
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) ERROR 2013 (HY00 ...
- ERROR 1045 (28000): Access denied for user root@localhost (using password:
错误描述: Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误.删除user.user中值为NULL的,或更新NULL ...
随机推荐
- ios开发之--为父view上的子view添加阴影
项目中碰到一个问题,在tableview的headerview里面有很一个子view,设计师的要求是在下方添加一个阴影,效果如下: 以前的实现思路就是,代码如下: 添加阴影 调用视图的 layer C ...
- sparkSQL中的example学习(3)
UserDefinedTypedAggregation.scala(用户可自定义类型) import org.apache.spark.sql.expressions.Aggregator impor ...
- Hibernate基于注解实现自关联树形结构实现
很久没用过Hibernate了,项目需求需要使用,并建立树形结构,在开发中遇到一些问题,在这里记录一下. 1.创建数据库表,主要是设置标志信息,不然插入数据库会报id不能插入null的错误. 2.创建 ...
- if,for,异常,random模块,计算圆周率
一.分支结构 单分支结构 if 一般用于判断选择 score = 95 if score > 90: print('优秀') 双分支结构 if...else age = 20 if age &g ...
- C# 上传本地视频到七牛云服务器
第一步添加DLL引用 Install-Package Newtonsoft.Json Install-Package Qiniu #region 七牛云视频上传 /// <summary> ...
- 01-numpy-笔记-empty
import numpy as np >>> a = np.empty([2,3]) >>> a array([[0.00000000e+000, 4.935933 ...
- c:forTokens标签循环输出
对带有相同符合格式内容进行分割输出,例如,varstr="1,2,3,4,5,6"; c:forTokens属性说明表 引用 varStatus,它们描述了迭代的当前状态,如下这些 ...
- HTML中,input元素的 Disabled属性 所产生的后端无法接收数据的问题
背景 今天从前端提交 form表单 数据时,发现 设置 Disabled 的 input 元素的字段数据在后端无法接收到 原因 查阅资料(来自W3school): disabled 属性规定应该禁用 ...
- MySQL实战45讲学习笔记:第十讲
一 .本节内容概要 前面我们介绍过索引,你已经知道了在 MySQL 中一张表其实是可以支持多个索引的.但是,你写 SQL 语句的时候,并没有主动指定使用哪个索引.也就是说,使用哪个索引是由MySQL ...
- [LeetCode] 921. Minimum Add to Make Parentheses Valid 使括号有效的最少添加
Given a string S of '(' and ')' parentheses, we add the minimum number of parentheses ( '(' or ')', ...