当前位置:网站首页>MySql的root密码忘记该怎么找回
MySql的root密码忘记该怎么找回
2022-07-05 19:53:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
Windows 下如果MySQL密码忘记了root密码导致无法登录,如下图所示,
这个时候怎么办,只能重置root密码了。
1.打开任务管理器查看MySql服务是否启动,如果已启动则先将其停止
2.找到MySql目录下的my.ini文件
3.打开该文件,找到里面的[mysqld],然后在这个下面添加skip-grant-tables,添加完后保存文件
4.重新进到任务管理器将MySQL服务启动起来
5.以管理员身份运行cmd
注意这里必须以此方式用管理员身份运行cmd,不能用win+R输入cmd运行,否则会出现 “’mysql’ 不是内部或外部命令,也不是可运行的程序或批处理文件”的错误。
6.输入mysql -u root -p就可以不用密码登录了,出现password:的时候直接回车可以进入。
7.进入mysql数据库:
mysql> use mysql;Database changed
8.给root用户设置新密码:mysql> update user set password=password(“123456″) where user=”root”;
提示:Query OK, 1 rows affected (0.04 sec)Rows matched: 1 Changed: 1 Warnings: 0
PS:123456为新密码,用户可根据自己需要修改成自己的密码
9.打开之前的my.ini文件将添加的”skip-grant-tables“这行删除
10.打开任务管理器重启MySQL服务。接着我们就可以用刚设置的密码 “123456”连接数据库了。
Mysql的root密码修改成功!
补充说明!!!
最后一步update user set password=password(“root”) where user=”root”; 只适用于5.5版本; 5.7版本要把第一个password字段改成authentication_string; 结果为update user set authentication_string=password(“123456″) where user=”root”
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/149933.html原文链接:https://javaforall.cn
边栏推荐
- XaaS 陷阱:万物皆服务(可能)并不是IT真正需要的东西
- 司空见惯 - 英雄扫雷鼠
- c——顺序结构
- Inventory of the most complete low code / no code platforms in the whole network: Jiandao cloud, partner cloud, Mingdao cloud, Qingliu, xurong cloud, Jijian cloud, treelab, nailing · Yida, Tencent clo
- Debezium series: idea integrates lexical and grammatical analysis ANTLR, and check the DDL, DML and other statements supported by debezium
- 全网最全的低代码/无代码平台盘点:简道云、伙伴云、明道云、轻流、速融云、集简云、Treelab、钉钉·宜搭、腾讯云·微搭、智能云·爱速搭、百数云
- Realizing deep learning framework from zero -- LSTM from theory to practice [practice]
- MMO project learning 1: preheating
- Debezium series: modify the source code to support UNIX_ timestamp() as DEFAULT value
- Jvmrandom cannot set seeds | problem tracing | source code tracing
猜你喜欢

third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctl

redis集群模拟消息队列

通过POI追加数据到excel中小案例

Go language | 01 wsl+vscode environment construction pit avoidance Guide

建议收藏,我的腾讯Android面试经历分享
Successful entry into Baidu, 35K monthly salary, 2022 Android development interview answer

城链科技数字化创新战略峰会圆满召开

使用easyexcel模板导出的两个坑(Map空数据列错乱和不支持嵌套对象)

使用 RepositoryProvider简化父子组件的传值
![[C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp](/img/32/738df44b6005fd84b4a9037464e61e.jpg)
[C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp
随机推荐
完爆面试官,一线互联网企业高级Android工程师面试题大全
Database logic processing function
Do you know several assertion methods commonly used by JMeter?
third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctl
Analysis of openh264 decoded data flow
Recommended collection, my Tencent Android interview experience sharing
Tasks in GStreamer
Information / data
Relationship between floating elements and parent and brother boxes
Summer Challenge harmonyos - realize message notification function
leetcode刷题:二叉树17(从中序与后序遍历序列构造二叉树)
MMO項目學習一:預熱
Necessary skills for interview in large factories, 2022android will not die, I will not fall
Apprentissage du projet MMO I: préchauffage
Summer Challenge database Xueba notes, quick review of exams / interviews~
Reinforcement learning - learning notes 4 | actor critical
What is the core value of testing?
The difference between ID selector and class selector
Fundamentals of deep learning convolutional neural network (CNN)
【C语言】字符串函数及模拟实现strlen&&strcpy&&strcat&&strcmp