Sometimes we may get into this kind of situation. We forgot the important passwords, or may the password we saved does not work. Here are the steps to change the MySQL password on your VPS Server:
Note: Kindly ensure to take a backup of the my.ini file before making any changes.
- Firstly, navigate to your MySQL installation directory.
- Then, click on to Data directory.
- Now, open the file my.ini.
- Next, restart MySQL Service after saving.
- Now, you can log in to MySQL prompt without a Password.
- Now, navigate to MySQL Prompt.
- Then, type the following into the command prompt,
Code:
UPDATE mysql.user SET Password=PASSWORD('New_password') WHERE User='root';"
Query OK, 0 rows affected (0.04 sec) Rows matched: 1 Changed: 0 Warnings: 0"
- Now, type FLUSH PRIVILEGES and press Enter.
- Also, you must undo the changes made in the my.ini file.
- Lastly, remove skip-grant-tables from my.ini and restart MySQL Service.
------------------------------------
Regards,
Rex Maughan
Leave a comment: