phpMyAdmin on Ubuntu 18.04

Install

sudo apt-get update
sudo apt-get install phpmyadmin php-mbstring php-gettext

When prompted, select apache2

Select "apache2"

<Yes> for dbconfig-common
### Explicitly enable the mbstring PHP extension
sudo phpenmod mbstring

### Load changes
sudo systemctl restart apache2

Secure phpMyAdmin instance

### Create .htaccess and enable it
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
### AllowOverride All
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
...

### Restart Apache2
sudo systemctl restart apache2

Create .htaccess at the installed directory

sudo nano /usr/share/phpmyadmin/.htaccess
AuthType Basic
AuthName "Restricted area"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user

Create .htpasswd within /etc/phpmyadmin directory

sudo htpasswd -c /etc/phpmyadmin/.htpasswd kim

### If you want to add additional users
sudo htpasswd /etc/phpmyadmin/.htpasswd kim2

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top