GNU/Linux, Open Source, Cloud Computing, DevOps and more...

ERROR: PleskFatalException – Unable to connect to database: saved admin password is incorrect.

5 comments

plesk_8_3After subscribing a new VPS server from my hosting provider, I found that although I could access to Plesk control panel properly, I was unable to access MySQL with the same admin’s user and password as used in Plesk. As a result, I couldn’t do anything with the database from the command line or in any other way. So I decided to manually change the admin user’s password via the mysql shell. After making such change I could perfectly log in to MySQL, but nevertheless the Plesk control panel stopped working, throwing the following exception:

ERROR: PleskFatalException
Unable to connect to database: saved admin password is incorrect.

0: common_func.php3:150
	psaerror(string 'Unable to connect to database: saved admin password is incorrect.')
1: auth.php3:107
ERROR: PleskFatalException
Unable to connect to database: saved admin password is incorrect.

0: common_func.php3:150
	psaerror(string 'Unable to connect to database: saved admin password is incorrect.')
1: auth.php3:107

After an online search for information about this issue, I found many sites explaining different solutions. In summary, the solutions were as follows:

Solution 1

The password in /etc/psa/.psa.shadow file used to grant access to Plesk Panel database does not match the MySQL admin user’s password, so it must be replaced with the following commands:

~# export PSA_PASSWORD=<new_password>
~# /usr/local/psa/admin/bin/ch_admin_passwd <new_password>

However, this solution has not been such in my case as I always got the following error message, even though the mysqld daemon was running perfectly:

Unable to connect to database: 1045

Solution 2

Since I couldn’t change the Plesk password, I tried to adapt the MySQL password to that already existing in Plesk. Everybody usually knows that password. Otherwise we’ll have to run the following command, although it is quite possible that we meet the same error “Unable to connect to database: 1045” from above:

~# /usr/local/psa/bin/admin --show-password

To solve this issue, we’ll add the following to the [mysqld] section in /etc/mysql/my.cnf database configuration file and restart MySQL:

skip-grant-tables

In this way we tell to MySQL not to do users and permissions checks, so the command “/usr/local/psa/bin/admin –show-password” now reports the password as set in Plesk, while we can also access MySQL as admin without knowing the password. This will allow us to set a password to our choice.

At this point most of the solutions to this problem I’ve checked, including the official solution from Plesk (http://kb.parallels.com/112492) go to change the admin user’s password:

~# /usr/bin/mysql -D mysql -e"UPDATE user SET password=PASSWORD('`cat /etc/psa/.psa.shadow`') WHERE User='admin';"

However, while it’s true that making this change results in Plesk Panel starts to work again with no more “Unable to connect to database: saved admin password is incorrect” exception messages, when we remove the skip-grant-tables parameter from /etc/mysql/my.cnf, MySQL refuses access again if we use the same password as set in Plesk.

Create an alternative user with all privileges from admin

The problem of both attempted solutions above were that we’re using the encrypted password from /etc/psa/.psa.shadow file to set MySQL password, not the password we actually want to use in clear text. Somewhere in the /usr/local/psa/admin/bin/ch_admin_passwd binary or elsewhere in Plesk there is an anomaly that does not give the password that we have assigned in clear text through the Plesk Panel to the admin user (later on MySQL internally takes care of storing it encrypted). Instead, the encrypted password from Plesk as it appears in the /etc/psa/.psa.shadow file is used, so we are always in a vicious circle where we can access to Plesk Panel and not to the database or viceversa.

We can resign and learn or write down the encrypted password somewhere, using it every time we access to MySQL, wich we’ll be able to do in a not very comfortable way, but with no problem.

But if we want to use our real password, that one we can easily remember and not that awful sequence of numbers and letters, the solution is to create an alternative user in MySQL with all admin privileges:

mysql> CREATE USER 'root'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

Finally we are able to administer the database as root with our desired password, having the Plesk control panel running smoothly with the admin user.



 

About the author

Daniel López Azaña
Cloud Solutions Architect

Entrepreneur, a generator of ideas and restless mind. Passionate about new technologies, especially Linux systems and Open Source Software. I also like to write about Technology News, Cloud Computing, DevOps, System Security, Web Development and Programming, SEO, Science, Innovation, Entrepreneurship, etc.

DanielERROR: PleskFatalException – Unable to connect to database: saved admin password is incorrect.

Related Posts

5 comments

Join the conversation
  • Seb - 12/10/2012 reply

    The first solution worked for me. Thanks for the post!

  • Antonio Madonna - 31/05/2013 reply

    The first solution is what I was looking for! Thank you!

  • Borja - 29/09/2014 reply

    Option 1 did’nt work for me.

    How can you create the user in MySQL?
    When I try to create the user, MySQL gives me an error:
    ERROR 1290 (HY000): The MySQL server is running with the –skip-grant-tables option so it cannot execute this statement

    john - 31/12/2014 reply

    Borja, Did you resolve this?

  • john - 31/12/2014 reply

    same here, option 1 didnt work, I can only access my plesk panel with –skip-grant-tables option enabled, I can not run commands like create new user while with –skip-grant-tables is enabled. If I remove it, I cant login !!

Leave a Reply

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

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.