User Tools

Site Tools


mysql:password_recovery

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mysql:password_recovery [2016/07/02 00:10] – created petermysql:password_recovery [2020/07/15 09:30] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== MySQL - Password Recovery ====== ====== MySQL - Password Recovery ======
  
 +If you've forgotten your root password, you'll need Linux Root login to reset your MySQL root password.  Here is the steps for resetting forgotten MySQL root password.
 +
 +
 +First login to your Linux box as a root user, and stop the **mysqld** daemon.
 +
 +<code bash>
 +service mysqld stop
 +</code>
 +
 +Now, start the **mysqld** daemon without the grant table bypassing authentication.
 +
 +<code bash>
 +mysqld_safe --skip-grant-tables &
 +</code>
 +
 +
 +The mysqld daemon should have started.  Now login as a root user without the password.
 +
 +<code bash>
 +mysql -u root
 +mysql> use mysql
 +</code>
 +
 +Reset the root user password.
 +
 +<code mysql>
 +mysql> update user set Password=PASSWORD('new-password') where user='root';
 +mysql> flush privileges;
 +mysql> exit;
 +</code>
 +
 +Restart the mysqld daemon, so that the new password will take into effect.
 +
 +<code bash>
 +service mysqld restart
 +</code>
 +
 +
 +===== Other methods to recover the MySQL root password =====
  
 <code mysql /var/lib/mysql/mysql-pass-recover> <code mysql /var/lib/mysql/mysql-pass-recover>
mysql/password_recovery.1467418200.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki