How to access MySQL without knowing its password in a Plesk server

Here I am explaining how you can access MySQL without knowing its password in a Plesk server.

# mysql -uadmin -p`cat /etc/psa/.psa.shadow`

The above command is used to access MySQL without prompting for a password.

In case, if you need to take backup of a database or you need to restore a database in a plesk server and you don’t know the MySQL root password, then you can follow the steps below:

 
# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` database_name > database.sql

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` database_name < database.sql

That’s it!!

Related Links:
Reset mysql root password from command line
How to allow mysql client to access remote mysql databases

Post navigation

Arunlal A

Engineer. Linux enthusiast. Traveller. DevOps learner and practitioner. I enjoy working with Linux, DevOps, automation, and technology while exploring new places along the way. I use this space to share my experiences, learnings, experiments, and things I discover along the journey. Whether you're a seasoned DevOps professional or just getting started, let's connect, learn, and grow together. Happy coding, automating, and deploying!

Leave a Reply

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