View database

---mysql view username and password 

select Host,user,password from mysql.user;

show DATABASES;

 

How to retrieve and reset the mysql database forgot login password

 
1. Open the folder where mysql.exe and mysqld.exe are located, and copy the path address (this machine is) D:\wamp\bin\mysql\mysql5.6.17\bin
How to retrieve and reset the mysql database forgot login password

2. Open the computer cmd command prompt and enter the folder where mysql.exe is located in the previous step (cd D:\wamp\bin\mysql\mysql5.6.17\bin)
How to retrieve and reset the mysql database forgot login password
3. Enter the command mysqld --skip-grant-tables and press Enter. At this time, the user authentication of mysql is skipped. Don't close this CMD window and open a new cmd command line window. (Note: Before entering this command, end the "mysqld.exe" process in the "Task Manager" to ensure that the mysql server has finished running.)
How to retrieve and reset the mysql database forgot login password
4. In the newly run CMD command line, go directly to the folder cd D:\wamp\bin\mysql\mysql5.6.17\bin, and then enter mysql. You can log in without any login parameters and press Enter. database.
How to retrieve and reset the mysql database forgot login password
5. Enter show databases; you can see all databases indicating successful login.
How to retrieve and reset the mysql database forgot login password
6. The mysql library is where the username is saved. Type use mysql; select the mysql database.
How to retrieve and reset the mysql database forgot login password
7.show tables To view all tables, you will find a user table, which stores account information such as username, password, permissions and so on.
How to retrieve and reset the mysql database forgot login password
8. Enter select user,host,password from user; to view account information.
How to retrieve and reset the mysql database forgot login password
9. Change the root password, enter update user set password=password('123456') where user='root' and host='localhost'; the 123456 password can be set by yourself, see Query ok, 1 means successfully update 1 row , the password is changed successfully
How to retrieve and reset the mysql database forgot login password
10. Close the two command line windows, restart mysql, the problem is solvedHow to retrieve and reset the mysql database forgot login password

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326065847&siteId=291194637