Restricting IP access to PHPMyAdmin

PHPMyAdmin is a very handle tool to allow web access to your MySQL databases.

For any PHP/MySQL server I build or use, phpymyadmin is a necessity to me and makes managing databases very easy.

However, this handy tool should be protected if possible. First off, if you are with a hosting company and use a CPanel or Plesk Panel, then they probably protect it for you, but if you are building your own servers, then one simple addition to your config.inc.php file will go a long way.

Somewhere at the bottom of your confic.inc.php file BEFORE

/*
*End of servers configuration
*/

Paste in:

//SECURITY
$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
'deny root from all',
'allow root from localhost',
'allow root from 10.10.10.10',
'allow root from 10.10.10.10',
'allow root from 10.10.10.10',
);

Now where I put in '10.10.10.10' you can replace with your IPs being local or public. The nice thing about this is that you can limit the IP addresses of who can access your PHPMyAdmin system. Now, the example above allows for root, I haven't tested with other mysql account names, but by restricting all root access and allowing only particular username access should work as well.

Keywords: phpmyadmin protect by IP, limit IP


Submit a Comment






Comments

Dragos

Posted on: Nov 26, 2010 2:15 am

works excellent

Cody

Posted on: Jul 1, 2009 5:23 pm

kick ass, now If I ever have a server that I need to do that to heh. i`m all for it :D