Installing PhpMyAdmin on Ubuntu 16.04 LEMP

Introduction

While many users need the functionality of a database management system like MySQL, they may not feel comfortable interacting with the system solely from the MySQL prompt.

phpMyAdmin was created so that users can interact with MySQL through a web interface. In this guide, we’ll discuss how to install and secure phpMyAdmin so that you can safely use it to manage your databases from an Ubuntu 16.04 system.

 

Prerequisites

It is assumed that you have already installed LEMP stack on Ubuntu 16.04. If not, please check out the following tutorial. How to Install a LEMP (Linux, Nginx, MySQL, PHP) Stack on Ubuntu 16.04

Once you are finished with these steps, you’re ready to get started with this guide.

 

Step One — Install phpMyAdmin/4.5.4

To get started, we can simply install phpMyAdmin from the default Ubuntu repositories.

We can do this by updating our local package index and then using the apt packaging system to pull down the files and install them on our system:

Once done, a new database named phpmyadmin is created and the database user phpmyadmin has necessary privileges to manage this database.

 

Step Two — Configure Nginx

To be able to access the phpMyAdmin web interface, we need to configure Nginx. We will configure Nginx so that phpMyAdmin is a sub-directory of the existing website. Open the default Nginx server block configuration file.

Add the following lines in the server section.

Your phpMyAdmin files are in /usr/share/phpmyadmin/ directory. The above configuration tells Nginx that if visitors enter your-domain.com/phpmyadmin in browser address bar, then find index.php file in /usr/share/phpmyadmin/ directory and display the web page.

Save and close the file. Then test configuration and reload.

Now you should be able to access phpMyAdmin web interface via

 

Using PhpMyAdmin as your development interface and keep getting logout after +-24 minutes? That is PhpMyAdmin default security policy, if you are not getting active or browsing on the browser for more than 1440 seconds, you will be logged out with the message “No activity within 1440 seconds; please log in again.”

Here is how to extend the session timeout to longer period;

  1. Settings > Features > Change the value of Login cookie validity > Save
  2. Open the default Nginx server block configuration file.

    Add the following lines in the location /phpmyadmin section.

    the Nginx default server block file looks like this:

    Save and close the file. Then test configuration and reload.

  3. Open PhpMyAdmin.

 

 

 

That’s it!

I hope this article helped you to install phpMyAdmin with Nginx on Ubuntu 16.04.

 

How to Install a LEMP (Linux, Nginx, MySQL, PHP) Stack on Ubuntu 16.04

 

 

Source:

  1. valuebound.com
  2. digitalocean.com