How To Install Phpmyadmin In Ubuntu 18.04 Nginx

How To Install Phpmyadmin In Ubuntu 18.04 Nginx


The MySQL database management system is one of the most popular and powerful open source database systems available today. To make managing MySQL databases easier, many webmasters install phpMyAdmin – a web-based graphical interface for MySQL administration. This tutorial will show you how to install phpMyAdmin on Ubuntu 18.04 (Nginx) for easy database management on your server.

A common misconception about phpMyAdmin is that it allows remote access to your MySQL databases. This is not true. phpMyAdmin is simply a graphical interface, accessed only through HTTP using a web browser. It does not provide access to the MySQL command line nor does it allow remote access to the MySQL databases.


Before you begin with this tutorial, please make sure that you have the following:

  • An Ubuntu 18.04 Droplet
  • A regular, non-root user with administrative privileges
  • Nginx installed on your system
  • MySQL installed on your system

To learn more about setting up a user with administrative privileges, consult the Initial Server Setup guide for Ubuntu 18.04. If you have not installed MySQL and Nginx yet, check out the MySQL setup guide and the Nginx Setup guide.

Step 1: Install phpMyAdmin

phpMyAdmin is included in the default package repositories for Ubuntu 18.04. You can install it with the standard apt package manager. To do so, update the local package index and then install the phpmyadmin package.

sudo apt update
sudo apt install phpmyadmin

During the install, you’ll be prompted to choose a webserver for use with phpMyAdmin. To use Nginx, select no by pressing the Space key. Afterward, select yes to restart Nginx. Confirm with yes to finish the configuration.

Once phpMyAdmin has been installed, it’s time to make a few changes to the default configuration. First, open phpMyAdmin’s main configuration file using your favorite text editor:

sudo nano /etc/phpmyadmin/

This file allows you to change a few phpMyAdmin settings. The most common change is to update the authentication type so that phpMyAdmin can access MySQL.

Look for the lines that begin with $i and type Authentication, ensuring that the value is set to signon.

It’s also a good idea to change the value of the AllowNoPassword line so that a password is required to log in to phpMyAdmin. To do so, change the value from true to false.

$cfg['Servers'][$i]['AllowNoPassword'] = false;

When you’re finished making these changes, save and exit the configuration file.

Step 2: Configure the Nginx Server Block

Now that phpMyAdmin has been installed, you’ll need to configure your Nginx server block to serve phpMyAdmin.

Create a new server block using your favorite text editor. Replace with your domain name.

sudo nano /etc/nginx/sites-available/

Add the following lines to the server block configuration, replacing “” and the PATH TO YOUR FILES placeholder with your domain name and the appropriate filepath:

location /phpmyadmin {
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+.php)$ {
try_files $uri =404;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

When you’re finished editing this file, save and exit.

Once you have the server block set up, you can enable it by creating a symbolic link to the file in the /etc/nginx/sites-enabled directory. To do this, use the following command (substituting your_domain for your domain name):

sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled

Now that you have an Nginx server block configured for phpMyAdmin, you can test your Nginx configuration files.

sudo nginx -t 

If everything is working properly, your output should look like this:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

When you have tested and saved your changes, enable phpMyAdmin by restarting Nginx.

sudo systemctl restart nginx

Step 3: Logging In To phpMyAdmin

At this point, you should now be able to access phpMyAdmin in your web browser by navigating to You can also use your server’s IP address if the domain is not yet pointed at the droplet.

You should see a login page. Enter the username and password of the MySQL user you wish to use. After a successful login, you should be able to manage your MySQL databases through a graphical interface.


You have now installed phpMyAdmin on Ubuntu 18.04 and configured it to use Nginx. You should be able to access phpMyAdmin in your web browser.


Q. What is phpMyAdmin?

phpMyAdmin is a web-based MySQL management tool. It allows you to easily create, modify, and delete databases, tables, columns, and more. It also allows you to easily export database data into various formats.

Q. Is phpMyAdmin secure?

phpMyAdmin is very secure. All data is encrypted in transit, and it supports strong authentication, limiting access to only those with the appropriate MySQL user credentials.

Q. What other databases does phpMyAdmin support?

phpMyAdmin supports a variety of other databases, including PostgreSQL, SQLite, and Microsoft SQL Server.

Q. Does phpMyAdmin allow remote access?

No, phpMyAdmin does not allow remote access to your databases. It is only accessible through the web interface, which is served only over a local connection.

Thank you for reading this article. Please take a look at our other articles for more tips and tricks for managing MySQL databases.

Leave a Reply

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