All about servers, control panels, linux commands and usefull how to's...
24 July 2013
04 July 2013
How To: Recover a MySQL root password
Stop the MySQL server process
# /etc/init.d/mysql stop
Start again with no grant tables
# mysqld_safe --skip-grant-tables &
Login to MySQL as root.
# mysql -u root
mysql> use mysql;
Set new password
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
Exit MySQL and restart MySQL server
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
# /etc/init.d/mysql stop
Start again with no grant tables
# mysqld_safe --skip-grant-tables &
Login to MySQL as root.
# mysql -u root
mysql> use mysql;
Set new password
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
Exit MySQL and restart MySQL server
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
Other useful commands:
Subscribe to:
Posts (Atom)