当前位置:网站首页>ERROR 1045 (28000) Access denied for user ‘root‘@‘localhost‘解决方法
ERROR 1045 (28000) Access denied for user ‘root‘@‘localhost‘解决方法
2022-07-30 19:30:00 【bsegebr】
事情起源
前天晚上好好的,第二天打开电脑正要开始写垃圾代码时,发现项目启动报错了,看了一下,发现是数据库连不上,我一脸懵逼,只能上csdn搜索大佬的文章,最后解决了问题。下面的过程是本人执行大佬教程时出现的问题并进行解决的过程。本人mysql版本如下:mysql-8.0.27-winx64。
操作
一、新建第一个cmd窗口,关闭mysql服务

二、新建第二个cmd窗口(管理员权限打开),跳过权限验证
mysqld --console --skip-grant-tables --shared-memory

三、新建第三个cmd窗口(管理员权限打开),无密码进入mysql,并清空密码
看到Enter passowrd直接爱搭不理,回车就行
update user set authentication_string='' where user='root';

四、关闭前面的cmd窗口(管理员权限打开),无密码进入mysql,并重置密码

前面一切顺利,当我要修改密码的时候,又给我报错了,说我密码太简单,开玩笑,“12345678”还简单,算了,只能修改mysql的规则了。
打开配置
发现policy是中等的
那就改成低级的吧
set global validate_password.policy=0;

再次执行 mysql> show variables like “%validate%”; 发现修改完成
总算可以修改密码了,开搞
啊这,又报错,我心态崩了啊。最后在查了其他资料之后,发现了新的修改方法。
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '12345678';

修改完成之后可以正常登录了
参考博客
https://blog.csdn.net/m0_46278037/article/details/113923726spm=1001.2014.3001.5502
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- Common linked list problems and their Go implementation
- Range.CopyFromRecordset 方法 (Excel)
- 实体中增加操作方法
- VS Code 连接SQL Server
- MindSpore:【模型训练】【mindinsight】timeline的时间和实际用时相差很远
- Spark学习:编译Spark项目时遇到的报错
- Range.CopyFromRecordset method (Excel)
- VBA批量将Excel数据导入Access数据库
- Spark学习:用spark实现ETL
- ImportError:attempted relative import with no known parent package
猜你喜欢

MySQL函数(经典收藏)
![[hbuilder] cannot run some projects, open the terminal and cannot enter commands](/img/fa/63f36683d090558f3fe5f582d86ca0.png)
[hbuilder] cannot run some projects, open the terminal and cannot enter commands

部分分类网络性能对比

VBA 运行时错误‘-2147217900(80040e14):自动化(Automation)错误

MySQL数据库 ---MySQL表的增删改查(进阶)

Is the iPhone really thirteen incense?The two generations of products are completely compared, perhaps the previous generation is more worth buying

Google's AlphaFold claims to have predicted almost every protein structure on Earth

Cesium加载离线地图和离线地形

vxe-table实现复选框鼠标拖动选中

MySQL六脉神剑,SQL通关大总结
随机推荐
【私人系列】日常PHP遇到的各种稀奇古怪的问题
SimpleOSS第三方库libcurl与引擎libcurl错误解决方法
Another company interview
How architects grow
云数据库和本地数据库有什么区别?
Zabbix 5.0 Monitoring Tutorial (1)
ImportError: attempted relative import with no known parent package
Swiper rotates pictures and plays background music
[flink] Error finishing Could not instantiate the executor. Make sure a planner module is on the classpath
Cesium加载离线地图和离线地形
JsonUtil基于字符串操作josn
Golang logging library zerolog use record
Is the iPhone really thirteen incense?The two generations of products are completely compared, perhaps the previous generation is more worth buying
Object和Map的区别
MySQL分库分表
MySQL六脉神剑,SQL通关大总结
防抖和节流有什么区别,分别用于什么场景?
JS提升:Promise中reject与then之间的关系
crontab中写go run不执行的问题
【MindSpore1.2.0-rc1产品】num_workers问题