My Digital Story

Just to make live easier…

Restrict phpMyAdmin access to only internal private IP address

I managed to configure my phpmyadmin to only allow access from within my network only (the private IP address range) e.g. 192.168.1.XXX.

This is important to ensure the security of your database, I just do not want people to guest all the password by entering into the phpmyadmin setting.

To do so, copy the following code to config.inc.php in the phpmyadmin folder:
//block root from logging in except from the private networks
$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
'deny root from all',
'allow root from localhost',
'allow root from 192.168.1.0/24',
);

The “0/24” denotes wildcat (equivalent to * in Windows)
After that chmod 705 the file
Then restart your lightpd server using the following command:
sh /ffp/start/lighttpd.sh restart

now your phpmyadmin can only be accessed from your LAN network only.

07/01/2009 - Posted by | Networking, Uncategorized |

17 Comments »

  1. Thank you for the script, was very helpful….:)

    Comment by sam | 28/05/2009

  2. Nice. It works, though it still allows people to try and log on. Would be better if PHPMyAdmin applied this to the logon page too.

    Comment by Tin | 18/06/2009

  3. Thanks for the tip. Very useful!!!

    Cheers

    Comment by Carlos Vendramini | 21/06/2009

  4. […] fonte: Restrict phpMyAdmin access to only internal private IP address […]

    Pingback by PHPMyAdmin somente para a rede interna « Linuxing | 21/06/2009

  5. FUCK ISLAM and eat HALAL ASS of your prophet

    Comment by FUCK ISLAM | 28/08/2009

  6. Thanks for the script. It did not work with my iMac, it still allow root access from other machines, although I commented the last line.

    I did not like the last comment. Even though I don’t agree with conservative Muslims, I don’t accept general blind blame

    Comment by Yahya | 18/10/2009

  7. Thanks for script. I did not work with lan without your code.

    Comment by hardik | 15/11/2009

  8. Hi!
    I use xampp. I want restrict access to phpmyadmin from internet.
    I changed config.inc.php, but i have access to phpmyadmin from internet. Please help me.

    Comment by Miroslav Kostov | 21/12/2009

  9. Prisons are built with stones of law, brothels with bricks of religion.

    Comment by Blake | 14/02/2010

  10. After adding your lines I get:
    #1045 – Access denied for user ‘root’@’localhost’ (using password: NO)

    Comment by hendrick | 22/02/2010

  11. It works! Brilliant!😀

    Comment by dave | 10/09/2010

  12. its great!

    Comment by jembo | 08/12/2010

  13. Порно фильмы бесплатно. Бесплатные порно фильмы онлайн.

    Comment by Thollophinc | 14/01/2011

  14. I would just like to ask something.
    I am using MySql “using “phpmyAdmin” in pc(PC1). All i want is to acces the data from my 2nd pc(PC2).
    when i typ the ip address(of PC1) using pc2 i cant connect to PC1.
    how wil i set this in order to view the program in PC1.
    thanks

    Comment by rickvill | 14/03/2011

  15. you’re awesome. thanks. cute bb’s

    Comment by enknot | 02/04/2011

  16. Miro trqbva da slojish tozi kod predi poslednita skoba }

    Comment by Anton Vasilev | 06/06/2011

  17. Excellent~~ Just what I am looking for~~ Works great!!
    Thanks~~

    Comment by aLEC | 09/09/2011


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: