Reset MySQL Root Password in Red Hat and CentOS
Here is the steps to reset the mysql root password on a Red Hat (RHEL) system or a CentOS system:
Stop MySQL service
# /etc/init.d/mysqld stop
Start MySQL in safe mode
# mysqld_safe --skip-grant-tables &
Log into MySQL as root, this time it will not ask for the password
# mysql -u root
Reset the password bt using the following mysql queries.
mysql> update mysql.user set password=PASSWORD("NewPassWorD") where User='root';
mysql> flush privileges; exit;
Stop MySQL service to exit from the safe mode.
# /etc/init.d/mysqld stop
Start MySQL in the normal mode:
# /etc/init.d/mysqld start
Log into MySQL with your new password:
# mysql -u root -p
Enter password:
mysql>
That's it...
Post a Comment