Posted by & filed under Web Development.

phpMyAdmin natively supports a global set of configuration options for all users, but with a simple hack you can change this allowing particular users the options that are most useful to them, such as default tab view, max rows per page, etc.

phpMyAdmin natively supports a global set of configuration options for all users, but with a simple hack you can change this allowing particular users the options that are most useful to them, such as default tab view, max rows per page, etc. It requires that you use phpMyAdmin’s auth_type of http. This hack is a pretty common technique which works for a number of web apps. We’ve used it with Mediawiki, WordPress, and others, here’s how:

  1. Make a copy of the configuration file, this file will contain the default global settings that users will inherit without special exceptions. For example:
    cp config.inc.php config.inc.global.php
  2. Make another copy for the user who should use alternate config options:
    cp config.inc.php config.inc.username.php
  3. Replace config.inc.php with the following:
    <?php
    switch ($_SERVER['PHP_AUTH_USER']) {
           case 'username':
           require_once 'config.inc.username.php';
           break;
    
           default:
           require_once 'config.inc.global.php';
           break;
    }
    ?>
  4. Edit config.inc.global.php and config.inc.username.php to your liking