PHPmyadmin setup security on Ubuntu Server 16.04
Commands:
1. sudo vim /etc/phpmyadmin/apache.conf
2. AllowOverride All
3. sudo vim /usr/share/phpmyadmin/.htaccess
4. AuthType Basic
AuthName “Restricted Files”
AuthUserFile /etc/apache2/.phpmyadmin.htpasswd
Require valid-user
5. sudo htpasswd -c /etc/apache2/.phpmyadmin.htpasswd ” username ”
6. sudo systemctl restart apache2.service
7. Order Allow,Deny
Allow from your public IP
8. curl http://icanhazip.com

source