• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

How to Install and Secure phpMyAdmin on Ubuntu 14.04 and 16.04

How VPS by How VPS
January 1, 2020
in Linux
0
0
SHARES
48
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Prerequisites
  2. Step 1: Downloading and Installing phpMyAdmin
    1. Starting Installation
    2. Installation Process
    3. Apache Setup and Restart
    4. Finishing Install
  3. Step 2: Securing phpMyAdmin
    1. Allow .htaccess Overrides
    2. Create a .htaccess file
    3. Create a .htpasswd file
  4. Conclusion
  5. Want to contribute?


Prerequisites

  • A new Vultr Ubuntu 14.04 or 16.04 server instance.
  • A static server IP (this is your main Vultr server IP).
  • A non-root server user with sudo privileges.
  • A full LAMP stack install (follow this Vultr guide to get it installed)

Step 1: Downloading and Installing phpMyAdmin

Starting Installation

Update Ubuntu’s apt repository and install phpMyAdmin.

sudo apt-get update
sudo apt-get install phpmyadmin

Installation Process

Now, answer the prompts for the installation.

WARNING:

On the first prompt, you MUST press “SPACE“, then “TAB“, and then “ENTER” to select Apache. (If you don’t, your install will be configured incorrectly. )

  • Select apache2
  • Select YES when prompted on whether or not to use dbconfig-common for database setup
  • Enter your MySQL/Database admin password
  • Select your new phpMyAdmin password

Apache Setup and Restart

PhpMyAdmin automatically adds it’s config file to Apache, so it doesn’t require additional configuration.

However, you need to enable mcrypt for Apache.

sudo php5enmod mcrypt

Then, just restart apache.

sudo service apache2 restart

Finishing Install

The phpMyAdmin interface is now running, and you can access it at the URL below.

http://192.0.2.0/phpmyadmin

Log in with the root user, using the password you created earlier.


Step 2: Securing phpMyAdmin

PhpMyAdmin is very easy to install, but it’s a huge target for hackers and malicious people because of it’s popularity. We will now secure phpMyAdmin against most attacks.

Allow .htaccess Overrides

First, allow Apache to accept .htaccess permission overrides. Just edit the file that was placed in Apache’s config directory.

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

Add AllowOverride All inside <Directory /usr/share/phpmyadmin> within the config file.

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

Now, save and close phpmyadmin.conf by pressing “CTRL+O“, then “ENTER” and finally “CTRL+X“.

As before, restart Apache.

sudo service apache2 restart

Create a .htaccess file

Now that overrides/.htaccess files are allowed, we’ll create one to provide the actual security.

Create and edit the file.

sudo nano /usr/share/phpmyadmin/.htaccess

Enter the following info.

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

Close and save the file.

Create a .htpasswd file

Now that we’ve told Apache we want to protect phpMyAdmin with a password, we need to create the file to tell Apache what password to accept.

Install an extra package to help us do this.

sudo apt-get install apache2-utils

We now have the htpasswd utility.

Create the .htpasswd file and the first user/login for it like this.

sudo htpasswd -c /etc/phpmyadmin/.htpasswd <username>

Replace <username> with the username you’d like to use. It will ask you to enter the password you would like to use for the user. Choose and confirm the password.

Now, access http://192.0.2.0/phpmyadmin. You will be asked for the username and password you just created. After entering the new username/password, you can then log in with your existing account from earlier.

Conclusion

You now have phpMyAdmin – one of the best, free web interfaces to manage your MySQL database without the command line.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

Install Nginx + PHP FPM + Caching + MySQL on Ubuntu 12.04

Next Post

Install BitTorrent Sync on Ubuntu 14.04

Next Post

Install BitTorrent Sync on Ubuntu 14.04

Leave a Reply Cancel reply

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

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet