这两天装了一个mysql 5.7数据库,但是在本地dos登陆不上去,报错Access denied for user 'root'@'localhost'(using password:YES);

也是网上找了各种方法,发现没有一个正确的,我就自己琢磨琢磨用别人的方法做了点改变,最后还成功了,啧,挺高兴的。又能愉快的学习了!

1,打开MySQL目录下的my.ini文件,在文件的最后添加一行“skip-grant-tables”,保存并关闭文件。
2,重启MySQL服务。
3,通过命令行进入MySQL的BIN目录,输入“mysql -u root -p”(不输入密码),回车即可进入数据库(最好用管理员运行cmd!)。
4,执行“use mysql;”,使用mysql数据库。

5,执行“ select * from user where user='root';”

你会看到很多乱码,其实不是乱码,这是mysql用户数据库,如下图:

authentication_string 这个字段就是用户root的密码了,我们来对他进行修改;可能不同版本数据库这个字段名称不一样,按照你的数据库中的字段来更新这个密码就行了。

6,执行“update user set authentication_string=PASSWORD("123456") where user='root';”(修改root的密码)
7,打开MySQL目录下的my.ini文件,删除最后一行的“skip-grant-tables”,保存并关闭文件。
重启MySQL服务。

ok,大功告成,你现在就可以连接数据库了!

希望对你有帮助!

————————————————
版权声明:本文为CSDN博主「晴天丶en」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_34397224/article/details/90454653

在MySQL登录时出现Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问,并可修改MySQL密码的更多相关文章

  1. 【转载】在MySQL登录时出现Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问,并可修改MySQL密码

    在MySQL登录时出现Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问,并可修改MySQL密码 2018年08月 ...

  2. mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”)的处理方法

    环境 CentosOS 6.5 ,已安装mysql 情景 root密码忘记,使用普通用户无法登录 解决 问题一 无法使用mysql命令 参考文章:https://www.cnblogs.com/com ...

  3. MySQL登录报错"Access denied for user 'root'@'localhost' (using password: YES)"

    最近登录MySQL时候总报错: # mysql -uroot -p Enter password: ERROR (): Access denied for user 'root'@'localhost ...

  4. linux下mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”)的处理方法

    最近登录某台服务器的mysql时候总报错: Access[root@log01 ~]# mysql -u root -p Enter password: ERROR 1045 (28000): Acc ...

  5. 最新 mysql登录报错“Access denied for user 'root'@'localhost' (using password: NO”的处理方法

    1.关闭正在运行的MySQL.2.打开DOS窗口,转到mysql\bin目录.3.输入mysqld --skip-grant-tables回车.如果没有出现提示信息,那就对了.(正常的情况是光标闪烁没 ...

  6. mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”的处理方法

    使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 文件内容: [client]host = localhostuser = debian-sys-maint ...

  7. centos 安装mysql 登录进提示 Access denied for user 'root'@'localhost' (using password: NO)

    # service mysqld stop # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # mysql ...

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

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

随机推荐

  1. 大数据笔记(一)——Hadoop的起源与背景知识

    一.大数据的5个特征(IBM提出): Volume(大量) Velocity(高速) Variety(多样) Value(价值) Varacity(真实性) 二.OLTP与OLAP 1.OLTP:联机 ...

  2. Mybatis,模糊查询语句,以及传参数的正确写法

    不多说直接上代码! 接口: public interface CommodityMapper { int deleteByPrimaryKey(Integer productId); int inse ...

  3. fengmiantu4

  4. ORA-00346,借助_allow_resetlogs_corruption开库

    Mon Aug 06 10:15:08 2018Errors in file /data/app/oracle/diag/rdbms/prod/prod/trace/prod_ora_6831.trc ...

  5. Phaser 源码分析

    Phaser 一个可重用的同步屏障,功能上与 CyclicBarrier 和 CountDownLatch 类似,但是支持更灵活的使用. 把多个线程协作执行的任务划分为多个阶段,编程时需要明确各个阶段 ...

  6. format和urlencode的使用对比

    一:format的基本语法使用 基本语法是通过 {} 和 : 来代替以前的 % . format 函数可以接受不限个参数,位置可以不按顺序. 例如: >>>"{} {}&q ...

  7. 013-Spring Boot web【二】静态资源、Servlet、Filter、listenter

    一.静态资源 1.1.webapp默认支持静态资源 在src/main/webapp下建立user.html默认支持访问 1.2.默认内置静态资源目录.可被直接访问 查看包:spring-boot-a ...

  8. yolov--7--解决报错:/bin/sh: 1: nvcc: not found make: *** [obj/convolutional_kernels.o] Error 127

    1.配置darknet配置darknet出现错误: qhy@qhy-desktop:~/darknet$ make cleanqhy@qhy-desktop:~/darknet$ make……gcc ...

  9. 006/搭建fabric(二)

    准备vmware虚拟机,并安装完ubuntu系统后.继续搭建fabric运行环境... 0.打开终端,切换root身份.目的:后续操作即可不用sudo... 右键->open Terminal- ...

  10. Proteus报错处理经验:power rails ‘GND’ and 'VCC/VDD' are interconnected in net VCC

    1 前言 初学Proteus,画好原理图后遇到了power rails 'GND' and 'VCC/VDD' are interconnected in net VCC的报错. 尝试了网上的解决办法 ...