Akhil Dev

Akhil Dev

Configure phpMyAdmin on Ubuntu 18.04 to Manage Remote MariaDB Databases


How to Configure phpMyAdmin on Ubuntu 18.04 to Manage Remote MariaDB Databases-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 allows you to manage MySQL or MariaDB databases via a simple web browser. In most environments, the phpMyAdmin package is install on the same server as the database server… so not many configurations are needed there… it should just work.

If you need to manage MySQL or MariaDB databases on a remote server via the phpMyAdmin web interface, you’ll need to make some changes in its configuration files.

Also, to access MySQL or MariaDB server remotely, you must configure the server to allow users to connect to it remotely and accessible over the network. The steps below will show you how.

This brief tutorial is going to install and Configure phpMyAdmin on Ubuntu 18.04 to Manage Remote MariaDB Databases. When you’re ready, please continue with the steps below:

Step 1: phpMyAdmin & Database on Same Host

Traditionally, phpMyAdmin and the MySQL / MariaDB servers are install on the same host. This is the standard installation and the most popular.

To install phpMyAdmin on the same host as the database server, run the commands below

sudo apt update
sudo apt install php libapache2-mod-phpmyadmin

During the installation, you should get a prompt to choose which webserver to be configured for phpMyAdmin. For this post, we will use Apache2 for the webserver.

After the installation, open your browser and go to http://servername/phpmyadmin

Replacing server name with the server’s actual hostname. At the login, page enters root for the username and login with the password.

This will get you logged-in and let you manage the databases on the server.

Step 2: phpMyAdmin & Database on Different Hosts

Step 1 shows the standard phpMyAdmin installation… however, when the database server you want to manage is remote, you’ll have to configure phpMyAdmin differently.

The configuration files for phpMyAdmin are located in /etc/phpmyadmin. The main configuration file is /etc/phpmyadmin/config.inc.php. This file contains configuration options that apply globally to phpMyAdmin.

To use phpMyAdmin to administer a MySQL database hosted on another server, adjust the following in /etc/phpmyadmin/config.inc.php:

sudo nano /etc/phpmyadmin/config.inc.php

Then change the line that looks like the one below

$cfg['Servers'][$i]['host'] = '$dbserver';


$cfg['Servers'][$i]['host'] = '';

Replace $dbserver with the actual remote database server name or IP address. Also, be sure that the phpMyAdmin host has permissions to access the remote database.

Another important configuration file is /etc/phpmyadmin/apache.conf, this file is symlinked to /etc/apache2/conf-available/phpmyadmin.conf, and, once enabled, is used to configure Apache2 to serve the phpMyAdmin site. The file contains directives for loading PHP, directory permissions, etc. From a terminal type:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo systemctl reload apache2.service

Step 3: Configure MariaDB Server to Allow Remote Access

Now that phpMyAdmin is installed on the client computer, connect to the remote server where the MySQL / MariaDB database is installed… then run the commands below to open its default configuration file.

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Then change the line below to:

bind-address           =    

Next run run the commands below to allow the root user to access the server from the client machine.

sudo mysql -u root -p

Replace the IP address with the address you’re connecting from. Exit and you’re done.

After editing the file above, save your changes and logon to http://clientPC/phpmyadmin

Replace http://clientPC/phpmyadmin with the client computer IP or hostname.

This should allow you to logon remotely to the server from the client phpMyAdmin web portal.

This how-to manage remote MySQL / MariaDB servers.


Congratulations! You’ve successfully configured phpMyAdmin




Leave a Comment

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