Reputation:
I forgot the password to one of the user in MySQL. Is there a way to recover MySQL user Password?
Upvotes: 3
Views: 14800
Reputation: 12727
You cannot recover but you can set a different one though:
like this:
- Stop & start the MySQL process with --skip-grant-tables option.
- Login to root user
List all the users;
SELECT * FROM mysql.user;
Reset password;
UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]';
restart the MySQL Process without the --skip-grant-tables option.
Or,
There is no need to restart the MySQL server.
use FLUSH PRIVILEGES;
after the update mysql.user statement for password change.
The FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.
The --skip-grant-options
enables anyone to connect without a password and with all privileges. Because this is insecure, you might want to
use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting.
from: reference: resetting-permissions-generic
Upvotes: 7