mysql server root password recovery

From thelinuxwiki
Revision as of 22:11, 24 May 2016 by Nighthawk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  1. Stop MySQL
# sudo /etc/init.d/mysqld stop
  1. start mysql in Safe mode


# mysqld_safe --skip-grant-tables &
  1. Login as root
# mysql -uroot
  1. Reset Password
# use mysql;
mysql> update user set password=PASSWORD("mynewpassword") where User='root';
mysql> flush privileges;
mysql> quit
  1. Restart
# killall mysqld
# /etc/init.d/mysqld start