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

解决方案:

1.编辑mysql配置文件my.ini

在mysql的安装目录下

,在[mysqld]这个条目下加入 skip-grant-tables 保存退出后重启mysql

[mysqld]
#作用是跳过登录的验证
#skip-grant-tables
port =
basedir=C:\\softwaretool\\mysql-5.7.-winx64
datadir=C:\\softwaretool\\mysql-5.7.-winx64\\data
max_connections=
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
max_allowed_packet = 20M
[mysql]
default-character-set=utf8

2.重启mysql

在计算机-管理-服务里面找到MySQL的服务,如图

这时候在cmd里面输入mysql -u root -p就可以不用密码登录了,出现 password:的时候直接回车可以进入,不会出现ERROR 1045 (28000),但很多操作都会受限制,因为没有grant权限。

3.进入mysql数据库,给root用户设置密码

mysql> use mysql;
mysql> update mysql.user set authentication_string=password('密码') where user='root' ;

4.刷新数据库,并退出

mysql> flush privileges;
mysql> quit;

5.修改my.ini文件

改好之后,再修改一下my.ini这个文件,把我们刚才加入的 "skip-grant-tables"这行删除,保存退出再重启mysql服务,再重新用Navicat连接就可以了。

[mysqld]
#作用是跳过登录的验证
#skip-grant-tables
port =
basedir=C:\\softwaretool\\mysql-5.7.-winx64
datadir=C:\\softwaretool\\mysql-5.7.-winx64\\data
max_connections=
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
max_allowed_packet = 20M
[mysql]
default-character-set=utf8

Mysql相关问题-----1045 Access denied for user 'root'@'localhost' (using password: YES)报错的更多相关文章

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

  2. 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 从网上找到的解决方法,以此博客 ...

  3. java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)报错

    今天用spring整合mybatis的时候,报了这个错误.去网上查了一下,网上大多数都是用户权限问题,但是我用SQLyog视图使用root用户crud没有问题,排除了是权限的问题,后面发现是idea提 ...

  4. 新手PHP连接MySQL数据库出问题(Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES))

    我用的环境是wampServer集成的软件包 在php连接MySQL数据库的时候老是出现这个问题Warning: mysqli_connect(): (HY000/1045): Access deni ...

  5. 解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes

    今天想用用MySQL 数据库  谁知道老提示 1045 access denied for user 'root'@'localhost' using password yes 最后在csdn 上找到 ...

  6. (转载)解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes

    今天想用用MySQL 数据库  谁知道老提示 1045 access denied for user 'root'@'localhost' using password yes 最后在csdn 上找到 ...

  7. Django链接Mysql 8.0 出现错误(1045:Access denied for user 'root'@'localhost' (using password: NO) 的一种解决方法

    运行环境: Django版本2.0 ; Mysql 版本 8.0.11; 错误代码:  django.db.utils.OperationalError: (1045:Access denied fo ...

  8. 1045 access denied for user 'root'@'localhost' using password yes的解决方法

    今天把一个项目和项目的数据库都下载到了本地,安装好项目和在本地配置好数据库后,在浏览器登陆项目的后台却出现了以下错误:   后来上百度搜索了好几个答案,都是讲述修改数据库密码的步骤,但是就是没有说明为 ...

  9. wamp中的phpmyadmin打开出现:#1045 - Access denied for user 'root'@'localhost' (using password: NO)

    详细内容: MySQL said: #1045 - Access denied for user 'root'@'localhost' (using password: NO) phpMyAdmin ...

随机推荐

  1. MySQL数据库查询所有表名

    查找指定库中所有表名 select table_name from information_schema.tables where table_schema='db_name'; 注:替换db_nam ...

  2. 转载:点云上实时三维目标检测的欧拉区域方案 ----Complex-YOLO

    感觉是机器翻译,好多地方不通顺,凑合看看 原文名称:Complex-YOLO: An Euler-Region-Proposal for  Real-time 3D Object Detection ...

  3. sql server 随记 -- 月份/日期 查询

    月份 SELECT * FROM ( ] ) a UNPIVOT ( xxx ]) ) a2; 日期 SELECT * FROM ( ] )a UNPIVOT( xxx ]) )a2 (存档)

  4. Java的23种设计模式,详细讲解(二)

    本人免费整理了Java高级资料,涵盖了Java.Redis.MongoDB.MySQL.Zookeeper.Spring Cloud.Dubbo高并发分布式等教程,一共30G,需要自己领取.传送门:h ...

  5. 02Javascript变量和数据类型

    1. 变量概述 1.1 什么是变量 通俗:变量是用于存放数据的容器. 我们通过 变量名 获取数据,甚至数据可以修改. 1.2 变量在内存中的存储 本质:变量是程序在内存中申请的一块用来存放数据的空间. ...

  6. Unity API学习笔记(2)-GameObject的3种Message消息方法

    官方文档>GameObject 首先建立测试对象: 在Father中添加两个脚本(GameObejctTest和Target),分别用来发送Message和接受Message: 在其它GameO ...

  7. 使用android日志工具

    Log的级别? 日志级别按照高低排序为:ERROR,WARN,INFO,DEBUG,VERBOSE, 日志输出: Log.e()输出ERROR级别的日志信息 Log.w()输出WARN,ERROR级别 ...

  8. [20190530]ORACLE 18c - ALTER SEQUENCE RESTART.txt

    [20190530]ORACLE 18c - ALTER SEQUENCE RESTART.txt --//以前遇到要重置或者调整seq比较麻烦,我有时候采用比较粗暴的方式就是删除重建.--//18c ...

  9. mysql-python 安装错误 fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory

    安装mysql-python之前, 请先安装setuptools. https://pypi.python.org/pypi/setuptools/7.0 下载mysql-python. 下载源码包. ...

  10. Linux 设置MySQL开启自动启动

    1. 将服务文件拷贝到init.d下,并重命名为mysql cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld 2. 赋 ...