Symptoms
When opening phpMyAdmin from Plesk, one of the following error messages appears:
#1045 - Access denied for user 'phpmyadmin'@'localhost' (using password: YES)
mysqli::real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES)
Connection for controluser as defined in your configuration failed.
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>';Find MySQL/MariaDB distrib version:
# mysql -V
# plesk db
Update the password for the phpMyAdmin user:
in MySQL 5.7/MariaDB 10.2 or newer versions:
ALTER USER 'phpmyadmin'@'localhost' IDENTIFIED BY '<password>';
in 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;