MySQL 错误【二】: Access denied for user ‘root‘@‘localhost‘ (using password: YES) 解决办法

阅读: 评论:0

MySQL 错误【二】: Access denied for user ‘root‘@‘localhost‘ (using password: YES) 解决办法

MySQL 错误【二】: Access denied for user ‘root‘@‘localhost‘ (using password: YES) 解决办法

注:

  1. 管理员下运行 cmd
  2. bin 目录下

  1. 在 my.ini 下添加 skip-grant-tables, 可免密登录

  2. 设置密码

D:mysql-5.7.35bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。D:mysql-5.7.35bin>mysql -u root -p
Enter password:   # 此处直接回车,不输入密码
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.7.35 MySQL Community Server (GPL)Copyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or 'h' for help. Type 'c' to clear the current sql> update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

host:确定要操作的数据库在哪台电脑上,比如上图的localhost代表的是本机,如果要操作的是别人的电脑,就需要输入其他的IP地址

  1. 注掉 skip-grant-tables
  2. 重启 MySQL 即可
mysql> exit
ByeD:mysql-5.7.35bin>net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。D:mysql-5.7.35bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
  1. 回到 Navicat 输入密码即成功解决

本文发布于:2024-02-03 06:11:14,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170691187449156.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:解决办法   错误   denied   Access   MySQL
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23