一、问题描述

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

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

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

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

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

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

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

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

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

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

  10. ERROR 1045 (28000): Access denied for user root@localhost (using password:

    错误描述: Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误.删除user.user中值为NULL的,或更新NULL ...

随机推荐

  1. 再谈EFAGE寄存器中的C位,P位,O位

    由于写EFLAGE博文中,有关C位,P位,O位,我觉得我没有描述清楚,而且C位也没有演示过借位情况,P位中也有些坑没讲,我还是决定再补一篇,争取把每个标志位描述清楚,不光是让看我文章的人能看的明白,也 ...

  2. LearnOpenGL.PBR.理论

    判断一种PBR光照模型是否是基于物理的,必须满足以下三个条件: ()基于微平面(Microfacet)的表面模型.Be based on the microfacet surface model. ( ...

  3. 08webpack-复习

    在调用loader的时候 都是从右往左进行加载的哦 //下面是现在学的webpack的配置文件哦 const path = require("path"); //路径模块 //第2 ...

  4. 201871010128-杨丽霞《面向对象程序设计(java)》第十周学习总结

    201871010128-杨丽霞<面向对象程序设计(java)>第十周学习总结 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这 ...

  5. 10-numpy笔记-np.random.randint

    b_idx = np.random.randint(0, 9, 90) >>> b_idx array([0, 1, 5, 4, 7, 2, 7, 0, 0, 4, 2, 2, 3, ...

  6. TCP/IP协议族(五)

    目前实际使用的网络模型是 TCP/IP 模型,它对 OSI 模型进行了简化,只包含了四层,从上到下分别是应用层.传输层.网络层和链路层(网络接口层),每一层都包含了若干协议. 协议(Protocol) ...

  7. shell脚本的输入以及脚本拥有特效地输出

    shell脚本的输入以及脚本拥有特效地输出 shell脚本输入之read命令 之前是直接在sh 后加参数 现在是另一种方式 语法:read -参数 -p:给出提示符.默认不支持"\n&quo ...

  8. VIJOS-P1232 核电站问题

    VIJOS-P1232 核电站问题 JDOJ 1373 https://neooj.com/oldoj/problem.php?id=1373 题目描述         一个核电站有N个放核物质的坑, ...

  9. VNC远程登陆树莓派3(包括开机启动)

    在树莓派上安装VNC需要使用命令行.如果需要远程操作安装VNC,就必须通过SSH登录到命令行界面(Raspbian的默认用户名是:pi,默认密码是:raspberry). 安装 命令行输入: sudo ...

  10. zzulioj - 2600: 有多少天?

    题目链接:http://acm.zzuli.edu.cn/problem.php?id=2600 题目描述 小D同学对日期类的问题很是有兴趣,已知1900-01-01是星期一,那么小D想知道给定两个年 ...