How do I Reset the MySQL password on my Server??


Unconfigured Ad Widget

  • Filter
  • Time
  • Show
Clear All
new posts
  • Ryaan J.
    Senior Member
    • Apr 2022
    • 100

    How do I Reset the MySQL password on my Server??


    I forgot the password for the MySQL service. Can anyone assist me with resetting the MySQL password on my Server?
  • Rex Maughan
    Senior Member
    • Mar 2022
    • 105

    Hello Ryaan J.

    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.
    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,
    UPDATE mysql.user SET Password=PASSWORD('New_password') WHERE User='root';"
    You can see the following message now:

    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.
    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.

    Rex Maughan
    Last edited by admin; 12-19-2022, 08:28 AM.