Unable to open phpMyAdmin: the page shows redirect loop

Created:

2016-12-12 03:45:17 UTC

Modified:

2017-08-08 13:35:41 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Unable to open phpMyAdmin: the page shows redirect loop

Applicable to:

  • Plesk 12.5 for Linux

Symptoms

  • Unable to open a database in phpMyAdmin: it redirects in loop

  • strace output shows:

    25686 19:10:36 recv(10, "M\\0\\0\\1\\377\\24\\4#42000Access denied for user 'user1'@'%' to database 'database1'", 140, MSG_DONTWAIT) = 81 <0.000012>
  • In domain's configuration files the access to "database1" is configured for "user2", not to "user1":

    # grep -r  '$user' /var/www/vhosts/domain.tld/httpdocs/*
    /var/www/vhosts/domain.tld/httpdocs/configuration-live.php: public $user ='user2';
    /var/www/vhosts/domain.tld/httpdocs/configuration.php: public $user = 'user2';
  • The user "user2" is configured for "database1" in mysql database:

    mysql> SHOW GRANTS FOR 'user2'@'%';
    +------------------------------------------------------------------------------------------------+
    | Grants for user2@% |
    +------------------------------------------------------------------------------------------------+
    | GRANT ALL PRIVILEGES ON *.* TO 'user2'@'%' IDENTIFIED BY PASSWORD '*****' WITH GRANT OPTION |
    | GRANT ALL PRIVILEGES ON `database1`.* TO 'user2'@'%' |
    +------------------------------------------------------------------------------------------------+
  • In psa database, user "user1" is configured for the "database1" database:

    mysql> select * from db_users where id in (select id from data_bases where name='database1');
    +----+-------+------------+-------+--------+--------+--------+--------------+-------------+-----------+
    | id | login | account_id | db_id | passwd | status | dom_id | db_server_id | external_id | role |
    +----+-------+------------+-------+--------+--------+--------+--------------+-------------+-----------+
    | 1 | user1 | 33 | 1 | | normal | 9 | 1 | NULL | readWrite |

Cause

Database inconsistency. Incorrect user is set to database1 in psa database.

Resolution

  1. Create psa database backup:

    MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin psa > /root/psa_backup.sql
  2. Set correct user to database1

    mysql> update db_users set login='user2' where id=1;
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1 Changed: 1 Warnings: 0
Have more questions? Submit a request
Please sign in to leave a comment.