解决MySQL数据库中1045错误[1045 Access denied for user 'root'@'localhost' (using password:YES)]
数据库连接异常
1045 Access denied for user 'root'@'localhost' (using password:YES)
这种问题的本质是用户密码出现错误
解决方案
1.找到MySQL安装路径下的my.ini文件
在mysqld这个位置,添加skip-grant-tables

skip-grant-tables作为启动参数的作用:MYSQL服务器不加载权限判断,任何用户都能访问数据库。启用这个参数之后,数据库的安全性会降低。
3.使用mysql命令修改
修改完成后,记得删除skip-grant-tables
Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。
PS C:\Windows\system32> 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.5.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
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 input statement.
mysql> use mysql
Database changed
mysql> update user set password=password("root") where user="root";
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,password from user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | 127.0.0.1 | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | ::1 | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| | localhost | |
+------+-----------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql>
3.windows重启服务

解决MySQL数据库中1045错误[1045 Access denied for user 'root'@'localhost' (using password:YES)]的更多相关文章
- 解决MySql ERROR 1698 (28000) 错误:Access denied for user 'root'@'localhost'
今天尝试在Ubuntu虚拟机上安装MySql 数据库(版本是:5.7.23-0Ubuntu0.18.04.1),数据库安装很简单,就是三行命令: sudo apt-get install mysq ...
- vue项目中连接MySQL时,报错ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password:YES)
一.前言 我们前端很多时候在写vue项目的时候,会把后端的数据拿到本地来跑,在连接MySQL数据库的时候,可能出现一些问题,如: ER_ACCESS_DENIED_ERROR: Access deni ...
- 远程数据库备份到本地出现“Access denied for user 'root'@localhost(using password: YES)”的问题
由于另外一个人在用远程的server做测试,导致我访问这个远程机器的mysql提示“too many connections”的问题,于是想到干脆把数据库当下来做测试好了,结果用heidiSQLs进行 ...
- 数据库之MySQL ERROR 1698 (28000) 错误:Access denied for user 'root'@'localhost'" error【摘抄】
声明:全文均摘抄于MySQL ERROR 1698 (28000) 错误 //错误起源: ~$ mysql -u root -p Enter password: ERROR 1698 (28000): ...
- mysql导入sql文件错误#1044 - Access denied for user 'root'@'localhost'
在我的个人知识管理中,经常用到mysql数据库,wordpress搭建的worklog.搜索测试数据.我blog的测试环境等.我在自己的电脑上整了WAMP(Windows Apache MySQL P ...
- JSP连接MySQL时出现--错误:Access denied for user 'root'@'localhost' (using password: YES)'解决方案
用代码进行用户验证的时候总是出现这个错误,翻译一下,应该是root用户的是权限的问题没有放开. 那就想办法解决一下吧,具体的来说可以有这样的几种方式. 解决方法,首先想到的是先重启一下MySQL服务吧 ...
- Navicat for Mysql远程连接数据时报(1045错误)Access denied for user 'root'@'localhost' (using password yes);
原因:用户访问被拒绝,更改用户赋予密码即可 mysql命令行执行语句如下 //使用mysql,读取表信息 //更改用户赋予登录密码 //更新权限 注意点:使用flush privileges是为了刷新 ...
- MYSQL问题解决方案:Access denied for user 'root'@'localhost' (using password:YES)
这两天在MyEclipse中开发Web项目时,连接MYSQL数据库,出现问题:Access denied for user 'root'@'localhost' (using password:YES ...
- 5. MYSQL问题:Access denied for user 'root'@'localhost' (using password:YES)
开发Web项目时,连接MYSQL数据库,出现问题:Access denied for user 'root'@'localhost' (using password:YES). 解决方案: ...
- idea 连接mysql报错:Access denied for user 'root'@'localhost'(using password:YES)。
这两天在idea中开发Web项目时,连接MYSQL数据库,出现问题:Access denied for user 'root'@'localhost'(using password:YES). ...
随机推荐
- DeepSeek火爆全网,官网宕机?本地部署一个随便玩「LLM探索」
前言 最近 DeepSeek 狠狠刷了一波屏,国产大模型真的越来越厉害了,官方的服务器已经爆满了,以至于频繁出现反应迟缓甚至宕机的情况,和两年多之前 ChatGPT 的遭遇颇为相似. 我已经好久没有本 ...
- Windows中安装和配置Maven
1.下载 下载地址:https://maven.apache.org/download.cgi 下载文件:https://dlcdn.apache.org/maven/maven-3/3.9.6/bi ...
- Kali 切换中文模式
Kali 切换中文模式 在桌面打开终端,输入sudo dpkg-reconfigure locales命令,然后输入kali的密码 在选择栏目找到 zh_CN.UTF-8 UTF-8 找到之后按 空格 ...
- [记录点滴] OpenResty中Redis操作总结
[记录点滴] OpenResty中Redis操作总结 0x00 摘要 本文总结了在OpenResty中的操作,与大家分享,涉及知识点为Openresty, Lua, Redis. 0x01 操作记录 ...
- 【FAQ】HarmonyOS SDK 闭源开放能力 —Live View Kit (1)
1.问题描述: 客户端创建实况窗后,通过Push kit更新实况窗内容,这个过程是自动更新的还是客户端解析push消息数据后填充数据更新?客户端除了接入Push kit和创建实况窗还需要做什么工作? ...
- Arduino部分C语言含义之--“::”
"::"在C++中表示作用域,和所属关系."::"是运算符中等级最高的.有三种作用. 1.作用域符号例如:A,B表示两个类,在A,B中都有成员member.那么 ...
- Lombok 只会用@Setter @Getter @Data ? 老鸟带你玩转lombok
lombok的官网 官方网址 : https://projectlombok.org lombok 稳定特性文档:https://projectlombok.org/features/ lombok ...
- 面试题10- II. 青蛙跳台阶问题
地址:https://leetcode-cn.com/problems/qing-wa-tiao-tai-jie-wen-ti-lcof/ <?php /** 一只青蛙一次可以跳上1级台阶,也可 ...
- vue3项目中环境变量使用技巧
在Vue 3项目中,环境变量是管理不同环境下配置的强大工具.以下是一些关于如何在Vue 3项目中有效地定义.访问和使用环境变量的技巧,以及如何在不同环境下管理这些变量的最佳实践. 一.定义环境变量 在 ...
- centos安装php环境
安装 PHP 所需扩展 yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcur ...