How To Install and Secure phpMyAdmin on Ubuntu 16.04

How To Install and Secure phpMyAdmin on Ubuntu 16.04

In this tutorial I will show you, how to install and secure phpMyAdmin on Ubuntu 16.04 server.

phpMyAdmin is an web-based tool for MySQL or MariaDB written in php. It is intended to perform various task such as creating, editing, deleting and updating a database easily using a graphical interface which is in contrast to a cli based database system.

Note: The following guide offers only basic security measures and does not guarantee a foolproof security method for your application, server or network. Always be careful!


  1. A Ubuntu 16.04 server.
  2. An ssh client such as Bitvise or Putty.
  3. Knowledge in linux command line is an advantage.
  4. We will assume that you already have installed LAMP on your server. If not, please follow the guide on installing LAMP server using Ubuntu.

    Installing phpMyAdmin

    Let us start by installing phpMyAdmin from our default Ubuntu repo. We can do the following steps by updating our local packages first using apt and then installing phpMyAdmin afterwards.

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

You will be asked a few questions to finalize your installation correctly.

 1. For the server, please select **Apache 2**.  
 2. Select **yes** when asked whether to use *dbconfig-common*.
 3. Enter your own database administrators password on the next step.
 4. Confirm your administrator password on the succeeding step and confirm a password for *phpMyAdmin* application itself.

Next, we will enable PHP mcrypt and mbstring extensions with the following commands:
sudo phpenmod mcrypt
sudo phpenmod mbstring

Next, we will need to restart apache for the server to recognize the changes.
sudo systemctl restart apache2

You can now access the phpMyAdmin web interface on the following web address:

You can now login to the web interface using your root username and the password you configured earlier.

Was this Tutorial helpful? Help others share on Facebook, Twitter, and Google Plus!

Enjoyed this video?
How To Install and Secure phpMyAdmin on Ubuntu 16.04
"No Thanks. Please Close This Box!"