Learn how to login as admin to the MySQL CLI in a plesk based server.

How to login as root (admin) user in the MySQL CLI with Plesk

Someone that has worked with the MySQL CLI knows how easy it is to access all databases on the server with the following command:

mysql -u root -p password

However, trying to do the same on plesk will fail basically because you will probably don't know what's the password to access MySQL. In this article we'll show you how to login as root/admin.

Logging in as admin in MySQL with Plesk

To login as admin (or root) to MySQL through the CLI in a server with Plesk you can use the following command:

MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin

What we are basically doing is to access as admin, the user that has all privileges to execute any query that you need with the encrypted password stored in the .psa.shadow file of Plesk. For more information about how to access to the MySQL CLI in Plesk, check the official article of Plesk here.

Happy coding !


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors