Monday, 10 September 2018

Hide the information schema in phpMyAdmin

When you log into phpMyAdmin you can only see the databases for which you have access rights, as well as the information_schema database. It is possible to hide this database if you want to. This post looks at how to hide the information_schema database in phpMyAdmin.

$cfg['Servers'][$i]['hide_db'] configuration option

phpMyAdmin's config.inc.php file has a lot of available settings and one of these is ['hide_db'] which can be specified on a server by server configuration.
Normally you would have something like this in your config.inc.php file:
/*
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = '';
$cfg['Servers'][$i]['controlpass'] = '';
It's then just a matter of adding this line underneath the above section:
$cfg['Servers'][$i]['hide_db'] = 'information_schema'; 
and the information_schema will no longer show.
If you have your phpMyAdmin configuration set up to be able to log into multiple servers you would then need to add that setting to each of the other server's settings as well.

Related posts:

0 comments:

Post a Comment