当前位置:网站首页>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
边栏推荐
- 【obs】libobs-winrt :CreateDispatcherQueueController
- 通配符选择器
- Autumn byte interviewer asked you any questions? In fact, you have stepped on thunder
- 浮动元素与父级、兄弟盒子的关系
- Fundamentals of shell programming (Chapter 9: loop)
- 函数的概念及语法
- [FAQ] summary of common causes and solutions of Huawei account service error 907135701
- Force buckle 729 My schedule I
- Redis cluster simulated message queue
- C application interface development foundation - form control (6) - menu bar, toolbar and status bar controls
猜你喜欢
What do software test engineers do? How about the prospect of treatment?
使用 RepositoryProvider简化父子组件的传值
Apprentissage du projet MMO I: préchauffage
集合
Webuploader file upload drag upload progress monitoring type control upload result monitoring control
Jvmrandom cannot set seeds | problem tracing | source code tracing
S7-200SMART利用V90 MODBUS通信控制库控制V90伺服的具体方法和步骤
C application interface development foundation - form control (5) - grouping control
After 95, Alibaba P7 published the payroll: it's really fragrant to make up this
S7-200smart uses V90 Modbus communication control library to control the specific methods and steps of V90 servo
随机推荐
That's awesome. It's enough to read this article
What does software testing do? What are the requirements for learning?
全网最全的低代码/无代码平台盘点:简道云、伙伴云、明道云、轻流、速融云、集简云、Treelab、钉钉·宜搭、腾讯云·微搭、智能云·爱速搭、百数云
Gstreamer中的task
Realizing deep learning framework from zero -- LSTM from theory to practice [practice]
【C语言】字符串函数及模拟实现strlen&&strcpy&&strcat&&strcmp
c——顺序结构
通配符选择器
软件测试工程师是做什么的?待遇前景怎么样?
Redis cluster simulated message queue
Common - Hero Minesweeper
S7-200SMART利用V90 MODBUS通信控制库控制V90伺服的具体方法和步骤
Relationship between floating elements and parent and brother boxes
webuploader文件上传 拖拽上传 进度监听 类型控制 上传结果监听控件
C application interface development foundation - form control (5) - grouping control
股票开户哪里好?网上客户经理开户安全吗
司空见惯 - 英雄扫雷鼠
【无标题】
[C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp
爬虫练习题(二)