Did you forget your mysql root password ? Do you have ssh access to your server ? If the answer to these questions is a YES then follow the instructions below to reset the root password for your mysql instance.
Stop mysqld and restart it with the
--skip-grant-tablesoption. This enables anyone to connect without a password and with all privileges. Because this is insecure, you might want to use
--skip-grant-tablesin conjunction with
--skip-networkingto prevent remote clients from connecting.
Connect to mysql server with this command:
- Issue the following statements in the mysql client. Replace the password with the password that you want to use.
mysql> **`UPDATE mysql.user SET Password=PASSWORD('MyNewPass')`**->**`WHERE User='root';`**mysql> **`FLUSH PRIVILEGES;`**
FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.
You should now be able to connect to the MySQL server as
root using the new password. Stop the server, then restart it normally (without the