The perfect solution for forgetting the password in mysql8.0.19

The perfect solution for forgetting the password in mysql8.0.19

Recommended reading: MySQL 8.0.19 supports account lock function after entering incorrect password three times (example)

1. Open a cmd window (preferably as an administrator), and run net stop mysql to stop the MySQL service.

2. Enable MySQL service that skips password verification

mysqld --console --skip-grant-tables --shared-memory

3. Open a new cmd window and start the mysql service

mysql -u root -p

4. Enter the password and press the space key to skip

5. Leave the password blank

use mysql
update user set authentication_string='' where user='root';
exit

6. Close the MySQL service opened in step 2 (just close the window)

7. Restart the MySQL service and log in without a password

8. Change password

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '111111';
flush privileges

Adding WITH mysql_native_password can ensure that navicat connection will not have any problems

Summarize

The above is the perfect solution to the problem of forgetting the password of MySQL 8.0.19 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • How to reset password after forgetting password in MySQL8 (MySQL old method doesn't work)
  • Solution for forgetting the root password of MySQL5.7 under Windows 8.1
  • A brief analysis of the best way to deal with forgotten MySQL 8 passwords
  • Pitfalls encountered when installing MySQL 8.0.18 compressed package and resetting forgotten passwords
  • mysql8.0 forgotten password modification and net command service name invalid problem
  • Quick solution for forgetting MySQL8 password

<<:  Docker's four network types principle examples

>>:  WeChat applet to save albums and pictures to albums

Recommend

JS implements WeChat's "shit bombing" function

Hello everyone, I am Qiufeng. Recently, WeChat ha...

How to set background blur with CSS

When making some pages, in order to make the page...

HTML table markup tutorial (15): table title

<br />This tag can be used to directly add a...

Analysis of 2 Token Reasons and Sample Code in Web Project Development

Table of contents question: There are 2 tokens in...

How to add docker port and get dockerfile

Get the Dockerfile from the Docker image docker h...

Use of js optional chaining operator

Preface The optional chaining operator (?.) allow...

How to design and create adaptive web pages

With the popularization of 3G, more and more peop...

How to set horizontal navigation structure in Html

This article shares with you two methods of setti...

UTF-8 and GB2312 web encoding

Recently, many students have asked me about web p...

Graphic tutorial on installing CentOS7 on VMware 15.5

1. Create a new virtual machine in VMware 15.5 1....

Practical method of deleting files from Linux command line

rm Command The rm command is a command that most ...

SQL function to merge a field together

Recently, I need to query all the fields in a rel...

CSS method of controlling element height from bottom to top and from top to bottom

Let’s start the discussion from a common question...