当前位置:网站首页>Mysql8. Method for resetting initial password above 0
Mysql8. Method for resetting initial password above 0
2022-04-21 14:50:00 【m0_ sixty million seven hundred and twenty-one thousand five hu】
Mysql8.0 The above method of resetting when forgetting the initial password
Abstract
Most of the methods on the Internet are through My.ini or My_default.ini Add –skip-grant-tables Method to skip Mysql Password to connect to the database , And change the password .
I spent nearly three hours using the online method , Want to skip the database login password through these methods , To change the initial password . It's a complete waste of three hours of my time .
After a period of groping , I finally found a feasible way .
The following command line code operates in administrator mode
Command line exe File directory :C:WindowsSystem32cmd.exe -> Right click -> With " Run in administrator mode "
First step : close Mysql service
First , Make sure you're closed Mysql Service for
cd c:webmysql-8.0.16in( Enter your own here Mysql Installation address )
net stop mysql

The second step : skip Mysql Password authentication
close Mysql After the service , Continue to C:webMysql-8.0.16in Operating under the directory
Input
mysqld --console --skip-grant-tables --shared-memory
After entering this line of code , We have successfully skipped Mysql Login with your password

The third step : Enter without password Mysql
After the above steps , Open another administrator mode cmd.exe
Get into mysql Under the bin After the directory , Direct login mysql
No need to pass net start mysql open mysql service
Enter the following code on the command line
cd c:webmysql-8.0.16in( Enter the installation directory on your computer here )
mysql -u root -p
A message appears asking you to enter your password , Directly enter , You can successfully connect Mysql

Step four : Set the login password to blank
Enter the code , Set password to empty ( You cannot change the password directly at this time , Must be set to null first , Otherwise, an error will be reported )
Input
use mysql; ( Use mysql Data sheet )
update user set authentication_string='' where user='root';( Leave the password blank )
quit; ( And then quit Mysql)

Step five : Change your login password
There are two parts here
1. Close the first cmd window ( Be sure to close !)
2. Enter the code in the second window
net stop mysql( close mysql service , Although it will show that the service is not enabled , But just in case ) net start mysql( And on again mysql service ) ( Don't bother here , If the last one mysql The service is not closed , We still log in without password ) cd C:webmysql-8.0.16in mysql -u root -p ( Enter password... Will be displayed here , Just go straight back , Step 4 we have left him empty ) ALTER USER 'root'@'localhost' IDENTIFIED BY ' New password ';( Change password )

The last step : Verify that the password was modified successfully
quit( sign out mysql)
mysql -u root -p
( Enter the new password , Log in again )
success ~~~
版权声明
本文为[m0_ sixty million seven hundred and twenty-one thousand five hu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211434339898.html
边栏推荐
- 制造字母异位词的最小步骤数-c语言解决
- 阿里云云效研发协同服务相关协议条款 |云效
- 虫子 1602
- Verse协议:一个优化NFT流动性的奇妙构思
- Beautiful solution for initialization of golang Gorm framework
- 如何在代码层面提供CPU分支预测效率
- 传奇服务器架设教程,传奇GM权限命令设置教程
- Shell sed and gawk editors use
- Minimum steps of manufacturing letter ectopic words - C language solution
- The conversion between RDD and dataframe in pyspark is realized by RDD processing dataframe: data segmentation and other functions
猜你喜欢
随机推荐
Special test 04 · differential calculus of multivariate functions [Li Yanfang's whole class]
MYSQL 第1章 数据库简介
虫子 PWM
五个拿来就能用的炫酷登录页面
Minimum steps of manufacturing letter ectopic words - C language solution
异步操作之后让await后续的代码能够继续执行
or1k启动文件分析
海外云服务器备份和恢复的6种最佳做法
Analysis on development mode of bounty hunter automatic Trading Robot
It's been 2 years since the career change test. Give some advice to girls who are still hesitating
传奇服务器架设教程,传奇GM权限命令设置教程
Dapr 远程调试之 Nocalhost
MySQL数据库实际运用(一)
Legendary server setup tutorial, legendary GM permission command setting tutorial
Day11作业
虫子 12864
pyspark中RDD和DataFrame之间的转换利用RDD处理DataFrame:数据分段等功能实现
MySQL 8.0.11安装教程(Windows版)
索信达获金融街资本1亿元投资
Shell sed and gawk editors use








