ERROR PleskMainDBException Access denied for user 'admin'@'localhost' (using password: YES)

Created:

2016-11-16 13:02:15 UTC

Modified:

2017-04-24 11:05:56 UTC

2

Was this article helpful?


Have more questions?

Submit a request

ERROR PleskMainDBException Access denied for user 'admin'@'localhost' (using password: YES)

Applicable to:

  • Plesk for Windows

Symptoms

  1. After upgrading Plesk on Windows or after changing the admin password, the following error is shown instead of the Plesk login page:

    Access denied for user 'admin'@'localhost' (using password: YES)
  2. Similar error appears when you are opening the phpmyadmin page after the issue above is resolved:

    You probably did not create a configuration file. You might want to use the setup script to create one.
    #1045 - Access denied for user 'admin'@'localhost' (using password: YES)

Cause

An incorrect password is set in the MySQL database for the admin user.

Resolution

1\. The first case error with MySQL on port 8306 can be repaired in 3 steps:

1.1. Add the skip-grant-tables option under the [PleskSQLServer] section of the file:

"%plesk_dir%"\\MySQL\\Data\\my.ini

Then restart the "Plesk SQL Server" service.

    net stop PleskSQLServer
net start PleskSQLServer

1.2. Then change the admin password:

"%plesk_cli%"\\init_conf.exe --set-admin-password -passwd <new_password>

1.3. Remove the skip-grant-tables and restart the service again.

2\. For the second case:

2.1 "%plesk_dir%\\mysql\\bin\\mysql.exe" -uadmin -P8306 -p psa
Enter password: ***********

mysql> select * from databaseservers;
+----+------------------------+------+-------+----------------+-------------+------------------------------------------------------------+-
| id | host | port | type | server_version | admin_login | admin_password |
+----+------------------------+------+-------+----------------+-------------+------------------------------------------------------------+-
| 1 | localhost | 3306 | mysql | 5.1.68 | admin | $AES-128-CBC$dOWumr1ccMryZe7HTKh+dA$tMQ0kteqadixYOK51a2Nmg |
| 2 | .\\MSSQLSERVER2008 | 0 | mssql | 10.50.1600 | sa | $AES-128-CBC$Mp/U5Dyj3Dp+u40mRnEkKA$M/EC+USxJjKfXUoXheqW2g |
+----+------------------------+------+-------+----------------+-------------+------------------------------------------------------------+-

2.2. Temporarily remove the row which describes the MySQL instance:

mysql> delete from databaseservers where id=1;
Query OK, 1 row affected (0.00 sec)

2.3 Go to Plesk -> Tools and Settings -> Database servers and add a mysql database with the admin username and your own password.

2.4. Check the newly added row in the databaseservers table and take the value from the admin_password column.

mysql> select * from databaseservers;
+----+-------------------+------+-------+----------------+-------------+------------------------------------------------------------+---------------+------------+
| id | host | port | type | server_version | admin_login | admin_password | parameters_id | last_error |
+----+-------------------+------+-------+----------------+-------------+------------------------------------------------------------+---------------+------------+
| 2 | .\\MSSQLSERVER2008 | 0 | mssql | 10.50.1600 | sa | $AES-128-CBC$Mp/U5Dyj3Dp+u40mRnEkKA$M/EC+USxJjKfXUoXheqW2g | 0 | no_error |
| 5 | localhost | 3306 | mysql | 5.1.68 | admin | $AES-128-CBC$G2NUq/EH0zPCHYxJeRiY8g$Up7gweyCwXl3I613+GTcDg | 189 | no_error |
+----+-------------------+------+-------+----------------+-------------+------------------------------------------------------------+---------------+------------+

2.5. Revert changes in this table back to their original state and set the new password only:

mysql> delete from databaseservers where id=5;
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO `databaseservers` VALUES (1,'localhost','3306','mysql','5.1.68','admin','$AES-128-CBC$dOWumr1ccMryZe7HTKh+dA$tMQ0kteqadixYOK51a2Nmg',NULL,'no_error');
Query OK, 1 row affected (0.00 sec)

mysql> UPDATE databaseservers SET admin_password='$AES-128-CBC$G2NUq/EH0zPCHYxJeRiY8g$Up7gweyCwXl3I613+GTcDg' where id=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Have more questions? Submit a request
Please sign in to leave a comment.