Find MySQL root password cPanel

Hi Guys,

This is only a small tip for those use cPanel servers. If you are looking to find the MySQL root password for the server, it’s easy and can be done in a flah of a second. The password is saved in file named .my.cnf under the root directory of your server. Using the cat command, you can get the password from the file as follows.

Login to the server as root user and run the below mentioned command on it.
root@server [~]# cat /root/.my.cnf [client] password="^*oR@2XE92_(19G" user=root

You may be able to run the MySQL commands directly if you are logged in as the root user to the server.
The MySQL configuration file on a cPanel server is located in /etc/my.cnf, please do take backup of databases and config files before you make any changes to them. When the server load goes high and if you find the that the MySQL is the one that eats up the CPU, you can check which database is causing problems for your server. There is a linux command for it and the syntax is pasted below:
mysqladmin proc stat
In the output, check which database is making more queries, repair or optimize it to get the load issues fixed.

Thank you 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *