0

I'm attempting to setup phpMyAdmin to administer multiple MySQL servers from a single instance. I've modified the sample config that was included in /usr/share/doc/phpmyadmin/examples/config.manyhosts.inc.php (the server is running Debian 8)

$i=0;
$hosts = array (
    ["addr" => "server1.example.com", "name" => "Server One"],
    ["addr" => "server2.example.com", "name" => "Server Two"],
    ["addr" => "server3.example.com", "name" => "Server Three"],
);

foreach ($hosts as $host) {
    $i++;
    $cfg['Servers'][$i]['verbose']  = $host["name"];
    $cfg['Servers'][$i]['host']     = $host["addr"];
    $cfg['Servers'][$i]['port']     = '';
    $cfg['Servers'][$i]['socket']   = '';
    $cfg['Servers'][$i]['connect_type']     = 'tcp';
    $cfg['Servers'][$i]['extension']        = 'mysqli';
    $cfg['Servers'][$i]['compress'] = FALSE;
    $cfg['Servers'][$i]['controluser']      = $dbuser;
    $cfg['Servers'][$i]['controlpass']      = $dbpass;
    $cfg['Servers'][$i]['controlhost']      = 'localhost';
    $cfg['Servers'][$i]['auth_type']        = 'cookie';
    $cfg['Servers'][$i]['user']     = '';
    $cfg['Servers'][$i]['password'] = '';
    $cfg['Servers'][$i]['only_db']  = '';
    $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';
    $cfg['Servers'][$i]['table_coords']     = 'pma__table_coords';
    $cfg['Servers'][$i]['pdf_pages']        = 'pma__pdf_pages';
    $cfg['Servers'][$i]['column_info']      = 'pma__column_info';
    $cfg['Servers'][$i]['history']  = 'pma__history';
    $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
    $cfg['Servers'][$i]['recent']  = 'pma__recent';
    $cfg['Servers'][$i]['table_uiprefs']  = 'pma__table_uiprefs';
    $cfg['Servers'][$i]['tracking']  = 'pma__tracking';
    $cfg['Servers'][$i]['userconfig']  = 'pma__userconfig';
    $cfg['Servers'][$i]['users']  = 'pma__users';
    $cfg['Servers'][$i]['usergroups']  = 'pma__usergroups';
    $cfg['Servers'][$i]['navigationhiding']  = 'pma__navigationhiding';
    $cfg['Servers'][$i]['savedsearches']  = 'pma__savedsearches';
}

This works sort of, at the login page and from the left pane after I'm logged in I have the "Current Server" dropdown where I can select my servers, however if from the navigation pane I try to change servers I'm redirected to the login page and phpMyAdmin shows a "#1045 Cannot log in to the MySQL server" error. Note that the usernames and passwords are the same on each server. If at the new login page I reenter username/password it logs in to that server fine, however switching back to the previous server produces the same problem.

If I set $cfg['Servers'][$i]['auth_type'] = 'http' this seems to work although I no longer get the normal login page. I assume this is because the browser is just replaying the login each time I change servers.

Is there anyway to achieve this while keeping $cfg['Servers'][$i]['auth_type'] = 'cookie'?

UPDATE After setting log_warnings = 2 on one of the MySQL servers I see failed login attempts with a jibberish username when I try to switch servers.

For example if phpMyAdmin is running on server1.example.com and I login to that MySQL server then change to server2.example.com, in server2's /var/log/mysql/error.log I see

[Warning] Access denied for user '??<???!?'@'server1.example.com' (using password: YES)

Instead of 'myusername'@'server1.example.com'

  • 2
    @austinian: This is unrelated. Your link talks about from which address a client might connect. This question is about how to allow to connect to more than one MySQL server. – Sven Aug 4 '15 at 19:48
  • Also I just saw this at phpmyadmin.net/support "Effective September 1st, 2013, support for questions directly related to phpMyAdmin has moved to stackoverflow. All prior support mechanisms have been phased out." Should I have asked this on stackoverflow instead? – Kevan Shea Aug 4 '15 at 22:54
  • I asked a similar question but nobody was able to answer it... serverfault.com/questions/825291/… – db_ch Feb 2 '17 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.