Unable to access PHPMyAdmin: Access denied

Created:

2016-11-16 13:04:03 UTC

Modified:

2017-08-22 16:11:52 UTC

6

Was this article helpful?


Have more questions?

Submit a request

Unable to access PHPMyAdmin: Access denied

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 11.x for Linux
  • Plesk 12.0 for Windows
  • Plesk 12.0 for Linux
  • Plesk 10.x for Linux

Symptoms

The following error occurs when trying to use PHPMyAdmin in Plesk:

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

Or

Cannot connect: invalid settings.
Connection for controluser as defined in your configuration failed.

Or it is not possible to login under user to PhpMyAdmin:

#1142 - SELECT command denied to user 'plesktest'@'localhost' for table 'pma_recent'

It's not possible to edit database via PhpMyAdmin interface.

Cause

The issue is caused by a mismatch between user login credentials stored in the phpMyAdmin configuration and the database.

Resolution

  1. Make sure that PHPMyAdmin user exists in the mysql.user table and has the right password and privileges. The username and password can be found in:

  2. $PRODUCT_ROOT_D/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php in Plesk 8.1, 8.2, 8.3, 8.4

  3. /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php in Plesk 12.5

For example:

    ~# grep controluser /opt/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php
$cfg['Servers'][$i]['controluser'] = $GLOBALS['db_host'] != 'localhost' ? '' : 'USER';
~#
~# grep controlpass /opt/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php
$cfg['Servers'][$i]['controlpass'] = 'PASSWORD';
~#
~# grep pmadb /opt/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php
$cfg['Servers'][$i]['pmadb'] = $GLOBALS['db_host'] != 'localhost' ? '' : 'DATABASE'; // Database used for Relation,
~#

Try to login as this user into MySQL from the command line.

    ~#mysql -uUSER -pPASSWORD DATABASE
  1. Update the mysql.user table and set PASSWORD as the password for USER .

  2. If such user doesn't exist in Mysql, create it with commands like:

        # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin
    mysql> INSERT INTO `db` VALUES ('localhost','DATABASE','USER','Y','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N');
    mysql> INSERT INTO `user` VALUES ('localhost','USER',password('PASSWORD'),'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);
    mysql> flush privileges;
  3. In case the user exists update password with the correct value:

        mysql> SET PASSWORD for 'USER'@'localhost' = password('PASSWORD');
    mysql> flush privileges;

Also refer to the KB article to fix the issue with database users.

Have more questions? Submit a request
Please sign in to leave a comment.