How to reset mySQL password

Asked By 0 points N/A Posted on -
qa-featured

I recently created a password for my MySQL Server for security purposes for my website. I forgot my password thus I cannot access my server. I did not create a back up and I cannot dare to delete the DB server.

How do I access the MySQL database users table and reset my root password?

Thank you in advance.

SHARE
Best Answer by payton evans
Best Answer
Best Answer
Answered By 0 points N/A #120404

How to reset mySQL password

qa-featured

Reset your My SQL PASSWORD, by stopping first the process of MySQL.  You can stop it by giving this command:

/etc/init.d/mysqld stop

After stopping the process of My SQL, eliminate this command: mysqld-safe –skip-grant-tables

Now open a new terminal, so that you can reset your password. It is now possible for you to sign in to MySQL and reset your password . In your additional terminal prompt, launch the MySQL path enter this:

mysql

mysql> use mysql;

mysql> UPDATE user SET Password=PASSWORD(‘YOUR_NEW_PASSWORD’) WHERE Host=’localhost’ AND User=’root’;
mysql> exit

  • Execute the running process of MySQL  from your former terminal, you can execute by CTRL+C;
  • Now begin again the  MySQL process  with the correct procedure by commanding this: /etc/init.d/mysqld start;
  • Sign-in to the MySQL path by inputting your new password: mysql –uroot -p;
  • You can  now use your new MySQL password.

Related Questions