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 Datadirectory.
Now, open the file my.ini.
Thus, you can see the 1st line [MySQLD] and the 2nd line as PORT=. Then, you must enter skip-grant-tables between those two lines.
Next, restart MySQL Service after saving.
Now, you can log in to MySQL prompt without a Password.
Note: After performing the above task, you need to reset the existing 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';"
Also, you must undo the changes made in the my.ini file.
Lastly, remove skip-grant-tables from my.ini and restart MySQL Service.
Finally, by implementing the above ways, you have completed resetting your MySQL root password on your server. However, If you face any issues, you can update them here.
------------------------------------ Regards,
Rex Maughan
Comment