Symptoms
When accessing Plesk in a web-browser or running a Plesk utility, the following error is shown:
DB query failed: SQLSTATE[HY000] [1045] Access denied for user 'admin'@'localhost' (using password: YES)
Cause
An incorrect password is set for the MySQL admin
user in the MySQL database.
Resolution
-
Connect to the Plesk server via RDP.
-
Open the MySQL configuration file:
C:> notepad '%plesk_dir%MySQLmy.ini'
-
Add the
skip-grant-tables
option under the[PleskSQLServer]
section:[PleskSQLServer]
skip-grant-tables -
Save the changes.
-
Restart the Plesk SQL Server service:
C:> net stop PleskSQLServer && net start PleskSQLServer
-
Find the MySQL / MariaDB server version:
C:> plesk db "SELECT VERSION();"
-
Depending on the version, change the admin password in the database:
C:> plesk db
use mysql;
FLUSH PRIVILEGES;
DROP USER 'admin'@'localhost';
CREATE USER 'admin'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('new_password');
GRANT ALL ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
exit
C:> plesk db "update mysql.user set authentication_string=password('new_password') where user='admin'"
-
Remove the
skip-grant-tables
from%plesk_dir%MySQLmy.ini
. -
Restart the Plesk SQL Server service:
C:> net stop PleskSQLServer && net start PleskSQLServer
-
Update the password in Windows registry:
C:> plesk sbin psadb --update-admin-password --password="new_password"