How to get the MySQL root password details – cPanel

The MySQL server saves its root password in a file “.my.cnf” under the root directory. You can find out its from the file as I mentioned.


root@server [~]# cat /root/.my.cnf

If you were loged in to the server as root user, then you do not need the password to access the MySQL. You can simply access the Database by executing the command “mysql”.


root@server [~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 275
Server version: 5.5.35-33.0 Percona Server (GPL), Release rel33.0, Revision 611
Copyright (c) 2009-2013 Percona LLC and/or its affiliates
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


That’s it!! 🙂

Reset mysql root password from command line
How to allow mysql client to access remote mysql databases
How to create/restore MySQL dump/backup of all the databases.
How to create a database and database user from command line
create a New Database-user and Grand Permissions

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

Leave a Reply

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