Security
phpMyAdmin has serious security vulnerability, allowing user to exploit root on underlying virtual private network. You can prevent these attacks by just locking down the whole directory with a username and password. It will secure you phpMyAdmin.
Set up .htaccess file
In order to setup .htaccess file first you have to get access to apache.conf
- Sudo nano /etc/phpmyadmin/apache.conf
- <Directory /usr/share/phpmyadmin>
- Options FollowSymLinks
- DirectoryIndex index.php
- AllowOverride All
- [. . .]
With this file we are able to setup a native user to access phpmyadmin.
First create .htaccess page in the phpmyadmin directory
- sudo nano /usr/share/phpmyadmin/.htaccess
- AuthType Basic
- AuthName "Restricted File"
- AuthUserFile /etc/apache2/.phpmyadmin.htpasswd
- Require valid-user
- sodu service apache2 restart
Now it's time to create valid username and password that you can remember.
- Sudo htpasswd –c /etc/apache2/.phpmyadmin.htpasswd username
Now access phpmyadmin it will ask you to enter username and password that you setup.

Join the conversation! Your thoughts help the community grow.