How to Install phpMyAdmin with LAMP on Ubuntu 16.04

phpMyAdmin is a MySQL/MariaDB web administration tool. In this tutorial, we’re going to learn how to install phpMyAdmin with LAMP (Apache, MariaDB, PHP7) on Ubuntu 16.04. It is assumed that you have already installed LAMP stack on Ubuntu 16.04. If not, please check out the following tutorial.

Once LAMP is installed, let’s install phpMyAdmin.

Installing phpMyAdmin on Ubuntu 16.04

phpMyAdmin is included in Ubuntu 16.04 software repository. so we can easily install it with the command below

sudo apt update
sudo apt install phpmyadmin

The above command will install all necessary dependencies including PHP7 extensions. During the installation, it will prompt you to select a web server to configure. Hit the space bar to select apache2. An asterisk means that the item is selected. Then hit Tab key and Enter to confirm your choice.

phpmyadmin lamp

In the next screen, select Yes.

phpmyadmin apache config

Then set a password for the phpmyadmin user in MariaDB/MySQL.

phpmyadmin ubuntu 16.04

Once this step is done, you will find that a new database named phpmyadmin is created in MariaDB. Next, enable mcrypt and mbstring extension.

sudo phpenmod mcrypt

sudo phpenmod mbstring

Reload Apache for the changes to take effect.

sudo systemctl reload apache2

Now you can access phpMyAdmin web interface via


You can use MariaDB/MySQL username and password to login.

phpmyadmin ubuntu

It is recommended that you always access phpMyAdmin over a secure HTTPS connection. If you have installed other web applications like WordPress and enabled HTTPS on those web applications on the same Ubuntu 16.04 system, then simply add /phpmyadmin after your domain name like below.

install phpmyadmin ubuntu

And now you can manage your MariDB/MySQL databases via a web interface.

To use .htaccess in phpMyAdmin, we need to add AllowOverride All  directive in Apache configuration files.

sudo nano /etc/apache2/conf-enabled/phpmyadmin.conf

Add AllowOverride All directive within <Directory /usr/share/phpmyadmin> like below

<Directory /usr/share/phpmyadmin>
  Options FollowSymLinks
  DirectoryIndex index.php
  AllowOverride All

If there’s no AllowOverride All directive, then it will default to AllowOverride none which disable .htaccess file.

Save and close the file. Then reload Apache.

sudo systemctl reload apache2

That’s it!

I hope this tutorial helped you install phpMyAdmin with LAMP on Ubuntu 16.04. As always, if you found this post useful, then subscribe to our free newsletter. You can also follow us on Google+ Twitter or like our Facebook page.

Rate this tutorial
[Total: 1 Average: 5]