Get the App
SLTechnology News&Howtos  ›  Database  › 

How to solve the problem of forgetting login password in mysql database

Shulou Source: shulou.com Published: 2022-06-01 03:22:52 10月15日 Update

This article mainly introduces how to solve the problem of mysql database forgetting login password, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

Nowadays, there are many places where we need to set a password, and there will always be times when we get confused or forget it. Let's talk about the main points of this article. For mysql root password forgetting, how should we retrieve it, or how to change the mysql database login password? Apache php mysql here I'm going to share with you a simple way to change your password:

1. First find and open the folder where mysql.exe and mysqld.exe are located (under the bin folder of the Mysql you installed), and copy the path address. As shown in the following figure

two。 Open the cmd command prompt and enter the folder where mysql.exe is located in the previous step. # (here I must run as an administrator) it is useless to open CMD directly)

3. Enter the command mysqld-- skip-grant-tables enter, and user authentication for mysql is skipped. Note that after entering this command, the command line is inoperable, and you can open a new command line at this time. Note: before entering this command, end the mysqld.exe process in the task manager and make sure that the mysql server side has finished running before doing so.

4. Then enter mysql directly, and you can log in to the database without any login parameters.

5. Enter show databases; to see all database instructions for successful login.

6. The mysql library is where the user name is saved. Enter use mysql; to select the mysql database.

7.show tables looks at all the tables and finds a user table that stores account information such as user name, password, permissions, and so on.

8. Enter select user,host,password from user; to view the account information.

9. Change the root password and enter update user set password=password ('root') where user='root' and host='localhost'; to change the password to root.

10. Check the account information again and select user,host,password from user; can see that the password has been changed.

11. Exit the command line, restart the mysql database, and try to log in with the new password.

Thank you for reading this article carefully. I hope it will be helpful for everyone to share how to solve the problem of forgetting login password in mysql database. At the same time, I also hope you can support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

Tags: Password input data database login command question information file folder user article account place is location user name administration run success Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Microsoft Huawei NVidia Shulou Tech Info