Symptoms
When opening phpMyAdmin via Plesk, the following error appears:
#1045 - Access denied for user 'phpmyadmin'@'localhost' (using password: YES)
Cause
The password set in the phpMyAdmin configuration does not match the actual password in MySQL.
Resolution
-
Connect to the Plesk server via SSH.
-
Find PhpMyAdmin password:
# grep controlpass /usr/local/psa/phpMyAdmin/config.plesk.php
$cfg['Servers'][$i]['controlpass'] = '<password>'; -
Update the password for the phpMyAdmin user:
For MySQL 5.7 or newer:
ALTER USER 'phpmyadmin'@'localhost' IDENTIFIED BY '<password>';
For older versions:
SET PASSWORD FOR 'phpmyadmin'@'localhost' = PASSWORD('<password>');
If there is no database entries or the file /usr/local/psa/phpMyAdmin/config.plesk.php
is missing:
Creating the configuration and database manually
-
Create a main configuration file from the sample:
# cp /usr/local/psa/phpMyAdmin/config.plesk.php.tpl /usr/local/psa/phpMyAdmin/config.plesk.php
-
Edited it as follows:
/* User used to manipulate with storage /
$cfg['Servers'][$i]['controlhost'] = 'localhost';
$cfg['Servers'][$i]['controlport'] = '';
$cfg['Servers'][$i]['controluser'] = 'phpmyadmin';
$cfg['Servers'][$i]['controlpass'] = '<password>';
/ Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info'; -
Connect to the database:
# plesk db
-
Switch to MySQL database:
use mysql;
-
Create the corresponding user:
CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL ON *.* TO 'phpmyadmin'@'localhost' with grant option;
flush privileges;
-
Create a corresponding database:
create database phpmyadmin;