mysql server root password recovery

From thelinuxwiki
Revision as of 03:07, 12 July 2016 by Nighthawk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Stop MySQL

# sudo /etc/init.d/mysql stop

start mysql in Safe mode


# mysqld_safe --skip-grant-tables &

Login as root

# mysql -uroot

Reset Password

mysql> use mysql;
mysql> update user set password=PASSWORD("mynewpassword") where User='root';
mysql> flush privileges;
mysql> quit

Restart

# killall mysqld
# /etc/init.d/mysql start

start and stop commands may vary depending on Linux distro