Articles in this section

Error when opening phpMyAdmin from Plesk: Access denied for user 'phpmyadmin'@'localhost' (using password: YES)

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

When opening phpMyAdmin from Plesk, one of the following error messages appears:

PLESK_ERROR: #1045 - Access denied for user 'phpmyadmin'@'localhost' (using password: YES)


PLESK_ERROR: 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

  1. Connect to the Plesk server via SSH.

  2. Find PhpMyAdmin password:

    # grep controlpass /usr/local/psa/phpMyAdmin/config.plesk.php
    $cfg['Servers'][$i]['controlpass'] = '<password>';

  3. Find MySQL/MariaDB distrib version:

    # mysql -V

  4. Access Plesk database:

    # plesk db

  5. 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
  1. Create a main configuration file from the sample:

    # cp /usr/local/psa/phpMyAdmin/config.plesk.php.tpl /usr/local/psa/phpMyAdmin/config.plesk.php

  2. 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';

  3. Connect to the database:

    # plesk db

  4. Switch to MySQL database:

    use mysql;

  5. Create the corresponding user:

    CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY '<password>';

    GRANT ALL ON *.* TO 'phpmyadmin'@'localhost' with grant option;

    flush privileges;

  6. Create a corresponding database:

    create database phpmyadmin;

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.