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 file will go a long way.

Somewhere at the bottom of your file BEFORE

*End of servers configuration

Paste in:

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

Now where I put in '' 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



Posted on: Nov 26, 2010 2:15 am

works excellent


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