MySQL Admin Password and Plesk Parallels 10

Anyone who is concerned within the technical facet of computing has skilled the ones days the place you chase your tail making an attempt to unravel an easy downside. Welcome to my fresh model of this precise day. Our number one actors listed here are Plesk Parallels 10, MySQL, Linux and a hapless developer (that may be me).

The Problem

The easy downside: Login to a MySQL server as admin, from a PHP script. I used this quick little bit of PHP code in a take a look at web page, put it on my website online and ran it:

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');

if (!$link) { die('Could not connect: '. mysql_error()); }
echo 'Connected successfully';


Result: Could no longer attach: ERROR 1045 (28000): Access denied for consumer ‘admin’@’localhost’ (the use of password: YES)

The Resolution Path

I attempted all of the glaring such things as checking the password used to be right kind however I nonetheless could not attach. So, I opened an SSH terminal and attempted the use of the command line to login. Again, really easy stuff:

mysql -u admin -p

and input the password when brought about. Again, no pleasure. Well, the excellent news is that there is no want for me to waste to any extent further time with the PHP script. The downside is surely with the username / password mixture. I do know that I’ve the password proper as a result of it is set through Plesk to be the similar because the password for Plesk.

Next, I attempt to get entry to the database by the use of phpMyAdmin by the use of Plesk. It works nice. So I alter the password in Plesk to one thing in reality easy, take a look at phpMyAdmin once more (it really works nice) after which attempt to login by the use of the command line once more. It fails. Same error.

All the time, I’m gazing the content material of the mysql.consumer desk by the use of phpMyAdmin and be aware that the password for the admin consumer does certainly trade. Of path, the password within the db is hash encoded so I do not know what the transparent textual content price is. I simplest know that it’s converting after I trade the Plesk password.

So at this level, Plesk clearly is aware of one thing I do not know so I seek at the boards and discover a wisdom base article telling me find out how to reset the password for Plesk and MySQL. Excellent! I observe the stairs exactly, try to login to MySQL from the command line and… it fails once more. I repeat the stairs two extra instances. It nonetheless fails.

But then I spotted one thing in reality unusual within the wisdom base article. One of the traces of code appears bizarre. Check out the road beneath and spot if you’ll spot it:

mysql -uadmin -p`cat /and so forth/psa/.psa.shadow` -D psa

The resolution to the query in the end led me to the repair. What I labored out used to be that the kb instruction used to be pulling in a price saved in an exterior record (/and so forth/psa/.psa.shadow) for the password. I went to test this record and likely sufficient, all it contained used to be an encoded string. I copied this string and attempted it verbatim as my password as I attempted to login by the use of the command line. Success! I then attempted it by the use of my PHP take a look at script and once more, good fortune!


The password that you just use for Plesk Parallels 10 may be used because the password for the admin consumer at the MySQL server.

However, the password is encoded through Plesk ahead of being set because the the MySQL admin password, the place MySQL then encodes it additional ahead of storing it within the database. The Plesk encoded model is written out, as the one access, to a record. On Linux distributions, the record is /and so forth/psa/.psa.shadow record.

You can reproduction the worth saved in that record for use because the password when logging in to MySQL by the use of the command line or by the use of a PHP script.