Daniel López Azaña

Theme

Social Media

Blog

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

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

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 (https://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.

MySQL Parallels Plesk
Daniel López Azaña

About the author

Daniel López Azaña

Tech entrepreneur and cloud architect with over 20 years of experience transforming infrastructures and automating processes.

Specialist in AI/LLM integration, Rust and Python development, and AWS & GCP architecture. Restless mind, idea generator, and passionate about technological innovation and AI.

Related articles

sugarcrm-logo-100068038-large

SugarCRM error when searching tasks related to custom modules with underscores within their names

When we create a custom module in SugarCRM (eg «grt_Providers_Contracts») and create a link or relationship between that module and one that uses the «Related to» field type such as «Tasks», we probably will want to search all the tasks related to our new module «grt_Providers_Contracts» from the simple or advanced search form from «Tasks» module.However, there is a bug in SugarCRM that prevents us to retrieve tasks related to a custom module if that module has underscores (_) within his name, showing the following fatal error:

November 19, 2012
Xorg icon

How to prevent the .xsession-errors file from growing to a huge size

The .xsession-errors file is where the X Window system logs all errors that occur within the Linux graphical environment. All desktop environments, whether Gnome, KDE, Cinnamon, XFCE, LXDE, etc., and all lighter window managers like FVWM, IceWM or Window Maker make use of the X Window system. Therefore any graphical application running on your computer can cause that error messages are written to the .xsession-errors file, reason why it can grow wildly until reaching very big sizes of tens of GB or even hundreds if your disk capacity allows it.

June 25, 2017
Ctrl+S

Unlock Linux command line after pressing Ctrl+s in Bash

Since the key combination Control+s is widely used as a shortcut to save files in GUI applications such as text editors, image editors, web browsers, etc. sometimes you are betrayed by your subconscious when you are working from the Linux command line and you use that same key combination when you are for example editing a Vim document when trying to save it. Then you notice that no key answers, the shell is locked and you can no longer do anything else in it.  Even worse, you get a cold sweat because you can’t continue editing your document and you can’t save the changes.

April 27, 2017

Comments

Be the first to comment

Submit comment