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 Ashok

DevOps Engineer at Zeta Suite. Linux lover. Traveller. Father of two princesses.

Always happy for an open discussion! Write to arun ((@)) crybit ((dot)) com.
LinkedIn: https://www.linkedin.com/in/arunlal-a-18037773/

Leave a Reply

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