This article introduces a method to retrieve the password of mysql. We use -- skip-grant-tables to retrieve the password of a forgotten mysql. If you need it, please refer to this article.
This article introduces a method to retrieve the password of mysql. We use -- skip-grant-tables to retrieve the password of a forgotten mysql. If you need it, please refer to this article.
MySQL password change method Daquan:
The Code is as follows: |
|
Mysql> update user set Password = password ('newpassword') where User = 'root'; mysql> flush privileges; MYSQLADMIN-u root-p PASSWORD mypasswd can be used to modify MY In the MYSQL folder. INI File Mysql> set password for myuser @ localhost = PASSWORD ('mypasswd'); mysql> grant usage on *. * TO myuser @ localhost identified by 'mypassword ';
|
The above content is an introduction to the MySQL password forgot solution. I hope you will get some benefits.
Operation Method of skip-grant-tables:
1. Kill the original mysql:
The Code is as follows: |
|
Rcmysqld stop Or: Service mysqld stop Or: Kill-TERM mysqld
|
2. Start mysql with command line parameters:
The Code is as follows: |
|
/Usr/bin/mysqld_safe -- skip-grant-tables &
|
3. Modify the administrator password:
The Code is as follows: |
|
Use mysql; Update user set password = password ('yournewpasswordhere ') where user = 'root '; Flush privileges; Exit;
|
4. Killing mysql and restarting mysql