How to reset the MySQL root password?
DBAs (Database Administrators) need to have root-level access to MySQL; sometimes, you might need to change the MySQL password for security or other reasons. In this article, you will learn how to reset the MySQL root password?
Using WHM Panel
1. First, login into WHM panel,
https://your-domain.com:2087 or https://IP-address: 2087 or https://server-hostname: 2087.
2. Navigate to SQL Services → MySQL Root Password.
3. Enter the password → Click on Change Password.
3. Congratulations! You have successfully changed MySQL password for root.
Using SSH
1. Login to SSH and run the following to login into MySQL as user root and enter the present MySQL’s root user password,
mysql -u root -p
If did not configure any password for MySQL root user then run the following command and simply hit Enter,
2. Run the following command to set the new password,
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MY-NEW-PASSWORD';
In the above command, we changed MySQL’s root user password to “MY-NEW-PASSWORD”; replace ‘MY-NEW-PASSWORD” with the desired password.
3. Next, run the following command to flush the privileges,
FLUSH PRIVILEGES;
Conclusion
We’ve gone over how to reset the MySQL root password for WHM and use the command-line interface. If you ever want to change the MySQL root password, you need to go through this article.
KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team ready to help you with requests should you need our assistance. You’re not using KnownHost for the best webhosting experience? Well, why not? Check with our Sales team to see what can KnownHost do for you in improving your webhosting experience.