Atlantic.Net Blog

How to Install and Secure phpMyAdmin in Ubuntu 14.04

Jose Velazquez
by Atlantic.Net (71posts) under HIPAA Compliant Dedicated Server Hosting
Verified and Tested 01/31/2015


This document will help you install phpMyAdmin and describe some basic steps to take in order to secure it.


You need an Ubuntu 14.04 server that is configured with a static IP address.

You will also need to have LAMP (Linux, Apache, MySQL and PHP) installed on the server.

Installing phpMyAdmin

Install phpMyAdmin

sudo apt-get install phpmyadmin

phpMyAdmin is now installed on your server. Now we begin the Apache configuration.


Setup phpMyAdmin under Apache, edit the apache2.conf file.

sudo nano /etc/apache2/apache2.conf

Add the following code to the bottom of the apache2.conf file.

Include /etc/phpmyadmin/apache.conf
Add your config file for phpmyadmin


Save your changes by pressing Ctrl + X then Y to accept.

Restart Apache.

sudo service apache2 restart

Verify that your installation works, type the following link in your browser http://YOURIP/myphpadmin

(Log in with the username and password that was created during the installation)

Securing myPHPAdmin

Setup security for phpMyAdmin, edit the apache.conf file:

sudo nano /etc/phpmyadmin/apache.conf

Locate the <Directory /usr/share/phpmyadmin> and add the following rule under DirectoryIndex index.php

AllowOverride All


Add directive AllowOveride All to apache.conf


Save your changes by pressing Ctrl + X then Y to accept.

Create the .htaccess file that will handle the authentication.

sudo nano /usr/share/phpmyadmin/.htaccess

Paste the following text in the file:

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/apache2/.phpmyadmin.htpasswd
Require valid-user
Sample: .htacess

Sample: .htacess

Save your changes by pressing Ctrl + X then Y to accept.

Create a user and password that you would like to use for security access by pasting the following code. Then you will enter and re enter your password. (Note:Replace username with the actual user that you want to create. I will be using admin).

sudo htpasswd -c /etc/apache2/.phpmyadmin.htpasswd username

Restart Apache.

sudo service apache2 restart

Verify that everything works by typing the following link in your browser http://YOURIP/myphpadmin and typing your security username and password

Sample Login Prompt

Sample Login Prompt

Congratulations! You have just installed and secured phpMyAdmin on your server. Thank you for following along in this How-To and feel free to check back with us for any new updates.


Since 1995, Atlantic.Net has been providing internet services to customers, including managed, cloud and dedicated hosting.   In 20+ years of service, our solutions have been focused on providing the very best in web solutions to our valued customers!

Start Your HIPAA Project with a Free Fully Audited HIPAA Platform Trial!

HIPAA Compliant Compute & Storage, Encrypted VPN, Security Firewall, BAA, Offsite Backups, Disaster Recovery, & More!

Start My Free Trial

Looking for HIPAA Compliant Hosting?

We Can Help with a Free Assessment.

  • IT Architecture Design, Security, & Guidance.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now!
Stevie Gold Award Med Tech Award

SOC Audit HIPAA Audit HITECH Audit

Case Studies

White Papers


HIPAA Partners

Recent Posts

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G2.1GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4


London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom