近些时间在开始学MySQL,安装挺顺利的,按照网上现成的教程就能安装成功。

    但是,在输入

mysql -uroot -p

    再输入密码时,遇到了这个情况

Access denied for user 'root'@'localhost' (using password: YES)

    在网上找了很多解决办法,但是基本只有一个,在.ini文件中的mysqld条目添加

skip-grant-tables

    然后重启服务器,再按照刚刚的步骤再来一遍(最后不输入密码),但是还是一条语句把我拦了下来

Access denied for user 'root'@'localhost' (using password: NO)

    综合了网上很多方法,自己一个一个拼接着去试,最后成功了

    总体上的思想还是修改.ini配置文件的内容,不过是通过命令行的形式修改,不知道是不是因为版本迭代了把以前那个直接修改文件的方法屏蔽了,无论如何,通过命令行修改在MySQL 8.0上是可以的。

    下面开始吧。

  • 以管理员身份打开cmd,切换到MySQL的bin目录
  • 关闭MySQL服务器
net stop mysql
  • 跳过输入密码的步骤(注意:文件名字与路径要与自己的吻合)
mysqld --defaults-file="D:\MySQL\my.ini" --console --skip-grant-tables
  • 如果出现类似截图圈起来的语句则说明成功

  • 重启服务器
net start mysql
  • 登录MySQL服务器
mysql -uroot -p

输入密码之后就能登录成功了。(数字1跟字母l很像很像)

  • 到这一步差不多就能完成了,但是当我输入
show databases;

    MySQL给我的反馈是:

You must reset your password using ALTER USER statement before executing this statement.

    我的猜测应该是MySQL认为安装时提供的随机密码不安全,让用户重置密码。

    网上找了一下,然后找到的现成办法。

    参考文章:https://dev.mysql.com/doc/ref...

  • 密码永不过期的
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码' PASSWORD EXPIRE NEVER;
  • 密码有限期的
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码' PASSWORD EXPIRE;

     然后重新登录一下服务器就能正常的操作了。

解决win10下MySQL 8.0登录Access denied for user 'root'@'localhost' (using password: YES)的问题的更多相关文章

  1. mysql登录:access denied for user 'root'@'localhost'(using password:YES)

    mysql登录: access denied for user 'root'@'localhost'(using password:YES) 解决: use mysql; select user,ho ...

  2. Windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes

    Windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes http://blog.csdn.n ...

  3. Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YSE)

    安装mysql后,使用命令登录mysql居然报错了,Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using ...

  4. MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO

    MySQL安装完server端和客户端后,登录Mysql时报错:[root@rhel204 MySQL 5.6.23-RMP]# mysqlERROR 2002 (HY000): Can't conn ...

  5. 远程连接Linux mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法

    在新安装好的Centos7上刚安装好mysql,准备进去看看,但是登陆的时候,发现报错啦: ERROR 1045 (28000): Access denied for user 'root'@'loc ...

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

  7. windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes 解决方案

    win7 MySql5.6.17提示:1045 access denied for user 'root'@'localhost' using password yes 从网上找到的解决方法,以此博客 ...

  8. Mysql相关问题-----1045 Access denied for user 'root'@'localhost' (using password: YES)报错

    MySQL 连接错误,使用Navicat连接MySQL出现错误:1045 Access denied for user 'root'@'localhost' (using password: YES) ...

  9. [mysql] ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).

    用mysql -u root -p显示ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YE ...

随机推荐

  1. 3016C语言_函数

    第六章 函数 6.1 函数概述 定义 函数:是具有一定功能的一个程序块:是C语言的基本组成单位. 在前面各章的例子及读者自己编写的C语言程序中都用到了以“main“开头的主函数,并且在程序中频繁地调用 ...

  2. 推荐三个学习git的网站或教程

    廖雪峰官方教程:https://www.liaoxuefeng.com/wiki/896043488029600/900388704535136 ProGit中文版:https://git-scm.c ...

  3. docker search/pull 报错

    docker报错 Get https://registry-1.docker.io/v2/: x509: certificate has expired or is not yet valid 这种错 ...

  4. Singleton and Prototype Bean Scope in Spring

    Scope描述的是Spring容器如何新建Bean的实例的. 1> Singleton: 一个Spring容器只有一个Bean的实例,此为Spring的默认配置,全容器共享一个实例. 2> ...

  5. C++ 洛谷 P1273 有线电视网 题解

     P1273 有线电视网  很明显,这是一道树形DP(图都画出来了,还不明显吗?) 未做完,持续更新中…… #include<cstdio> #include<cstring> ...

  6. LightOJ 1422:Halloween Costumes(区间DP入门)

    http://lightoj.com/volume_showproblem.php?problem=1422 题意:去参加派对,有n场派对,每场派对要穿第wi种衣服,可以选择外面套一件,也可以选择脱掉 ...

  7. 网络虚拟化基础协议·Geneve

    [分层] 要实现网络虚拟化,最基础的技术肯定是分层(OverLay & UnderLay). ·UnderLay 中文释义中,老房子漏雨,在房子里面撑一把大雨伞,这把大雨伞就是UnderLay ...

  8. Profibus 接线

    无论是组成MPI还是RPOFIBUS-DP网络,用到的主要部件都是一样的: PROFIBUS电缆:电缆型号有多种,其中最基本的是PROFIBUS FC(Fast Connect快速连接)Standar ...

  9. pycharm在服务器上远程调试 mac版本

    1. 首先要配置tools 2.点 +,选择SFTP, 填写 New server name:随便填写 3.然后填写 connection 和 Mapping Host:填写远程连接的ip地址 Use ...

  10. 前端动画 wow.js 效果

    让花里胡哨的特效变简单 wow.js动画class介绍 引入css样式以及js插件 <link rel="stylesheet" type="text/css&qu ...