Get the App
SLTechnology News&Howtos  ›  Database  › 

The solution of forgetting user's password in mysql5.7 Database

Shulou Source: shulou.com Published: 2022-05-31 18:27:00 10月02日 Update

This article mainly introduces "the solution of forgetting user password in mysql5.7 database". In daily operation, I believe that many people have doubts about the solution of forgetting user password in mysql5.7 database. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "mysql5.7 database forgetting user password solution". Next, please follow the editor to study!

1. Stop the mysql service first

2. Edit the configuration file my.cnf

Add the skip-grant-tables configuration item to [mysqld]. The purpose of this configuration is to "adjust the restrictions of the permission table, do not use password authentication, and log in to the data directly", but do not forget to delete this item in the production environment.

3. Start the msyql service

If you log in to the database, you don't need a password and go directly to the database.

4. Change the password

Direct execution:

Update mysql.user set authentication_string=password ('123456') where user='root' and host='localhost'

Flush privileges

5. Delete the skip-grant-tables configuration item in my.cnf and restart the mysql service

6. You can log in to the database with the new password.

At this point, on the "mysql5.7 database forget user password solution" on the end of the study, I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Data password database method user learning configuration service login more help utility next do not use function that is files articles is in permissions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Xiaomi NVidia vpn Docker