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

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 *