Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to reset the initial password in Mysql8.0

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to reset the initial password in Mysql8.0. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Step 1: shut down the Mysql service

First, make sure you have turned off Mysql's service.

Cd c:\ web\ mysql-8.0.16\ bin (enter your own Mysql installation address here) net stop mysql

Step 2: skip Mysql password verification

After shutting down the Mysql service, continue to operate in the C:\ web\ Mysql-8.0.16\ bin directory

Input

Mysqld-console-skip-grant-tables-shared-memory

After entering this line of code, we have successfully skipped the Mysql password to log in

Step 3: enter Mysql without password

After the above steps, open a cmd.exe running in administrator mode

After entering the bin directory under mysql, log in to mysql directly

You do not need to open the mysql service through net start mysql

Enter the following code on the command line

Cd c:\ web\ mysql-8.0.16\ bin (enter the installation directory on your computer here) mysql- u root-p

At this point, it will show you to enter your password, enter directly, and you can successfully connect to Mysql

Step 4: set the login password to empty

Enter the code and set the password to empty (the password cannot be changed directly at this time, it must be set to empty first, otherwise an error will be reported)

Input

Use mysql; (use mysql datasheet) update user set authentication_string='' where user='root'; (set password to empty) quit; (then exit Mysql)

Step 5: change your login password

This is divided into two parts.

1. Close the first cmd window (be sure to close!) two。 Enter the code in the second window

Net stop mysql (turn off the mysql service, although it will show that the service is not enabled, but just in case)

Net start mysql (turn on the mysql service again)

(don't bother here. If the last mysql service is not shut down, we will still log in without a password.)

Cd C:\ web\ mysql-8.0.16\ bin

Mysql-u root-p

(the input password will be displayed here, and just enter directly. In the fourth step, we have already left him empty.)

ALTER USER 'root'@'localhost' IDENTIFIED BY' New password; (change password)

The last step: verify whether the password has been changed successfully quit (exit mysql) mysql-u root-p (enter the new password and log in again) successfully ~ ~ above is how to reset the initial password in Mysql8.0 for everyone. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report