- Plesk for Linux
Plesk is inaccessible. One of the following error messages is shown in a browser:
PLESK_INFO: ERROR: Zend_Db_Adapter_Exception: SQLSTATE[HY000]  Access denied for user 'admin'@'localhost' (using password: YES)
PLESK_INFO: PleskDBException: Unable to connect to database: mysql_connect(): Access denied for user 'admin'@'localhost' (using password: YES) (Error code: 1045) (Abstract.php:69)
PLESK_INFO: ERROR: PleskFatalException
Unable to connect to database: saved admin password is incorrect.
psaerror(string 'Unable to connect to database: saved admin password is incorrect.')
Additionally, an exception has occurred while trying to report this error: Zend_Exception
No entry is registered for key &;translate&; (Abstract.php:144)
When creating a database backup, it fails with the following error message:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin psa > /tmp/psa.`date +%F_%H.%M`.sql
mysqldump: Got error: 1045: Access denied for user 'admin'@'localhost' (using password: YES) when trying to connect
The command "plesk db" shows the following error message:
CONFIG_TEXT: ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
The hashed password in the file /etc/psa/.psa.shadow, which is used to access Plesk database, does not match the admin password in MySQL.
The option old-passwords is enabled in the MySQL configuration file my.cnf.
- The strings "Password" and "authentication_string" are defined and the string plugin is set as "mysql_native_password" for the admin user in the mysql.user table.
Connect to a Plesk server via SSH.
Automatic Solution (Recommended)
Download, unzip and run automatic MySQL password reset script:
# wget https://support.plesk.com/hc/article_attachments/360002746434/mysql_passwd_reset.zip
# unzip mysql_passwd_reset.zip
# chmod +x mysql_passwd_reset.sh
Note: If the automatic solution did not help, apply the manual solution below.
With the command below, verify that the directive "old-passwords" is not specified in the MySQL configuration file my.cnf. If it exists, remove it using a text editor.
# grep -ir old-passwords /etc/my*
Get a hashed password of the MySQL "admin" user:
# cat /etc/psa/.psa.shadow
Connect to the "mysql" database:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin mysql
Note: If the connection to MySQL fails for the admin user, move to step 4. If the connection is successful, move to step 7.
Open the file /etc/my.cnf (on Debian/Ubuntu-based distributions: /etc/mysql/my.cnf) in a text editor and add the "skip-grant-tables" line under the [mysqld] section:
for CentOS/RHEL-based distributions:
# service mysqld restart
for Debian/Ubuntu-based distributions:
# service mysql restart
if MariaDB is installed:
# service mariadb restart
Connect to the "mysql" database:
# mysql -uadmin mysql
Find a version of MySQL:
MYSQL_LIN: mysql> SELECT VERSION();
Update the admin password:
Note: Replace valid_password with password got on step #2.
for MySQL 5.7.6 and greater:
MYSQL_LIN: mysql> UPDATE mysql.user SET authentication_string=PASSWORD('valid_password'), plugin='mysql_native_password' WHERE User='admin' AND Host='localhost';
for MariaDB (any version) / MySQL 5.6 and lower:
MYSQL_LIN: mysql> UPDATE mysql.user SET Password=PASSWORD('valid_password'), plugin='', authentication_string='' WHERE User='admin' AND Host='localhost';
Remove the skip-grant-tables record from the file /etc/my.cnf (on Debian/Ubuntu-based distributions: /etc/mysql/my.cnf) and restart MySQL.