Configure phpMyAdmin on Ubuntu 17.04 | 17.10 to Manage Remote MariaDB Databases

phpMyAdmin allows you to manage MySQL or MariaDB databases via a simple web browser. In most environments, phpMyAdmin package is installed on the same server as the database server… so not much configurations are needed there… it should just work.

If you need to manage MySQL or MariaDB databases on a remote server via 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 17.04 | 17.10 to access and manage a remote MySQL or MariaDB database server. 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 installed 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 web server to be configured for phpMyAdmin. For this post, we will use Apache2 for the web server.

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

Replacing servername with the server’s actual hostname. At the login, page enter root for the username and logon 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/ 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/

sudo nano /etc/phpmyadmin/

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 how to manage remote MySQL / MariaDB servers.

phpmyadmin logon page on ubuntu

Congratulations! You’ve successfully configured phpMyAdmin

ubuntu phpmyadmin


You may also like the post below:

One Reply to “Configure phpMyAdmin on Ubuntu 17.04 | 17.10 to Manage Remote MariaDB Databases”

  1. Hi,
    Good job.The steps yoy have given were clear. But while following the process, i was stuck up at 2nd step, i.e. Configuring PHP Myadmin. After installing PHPMyadmin, i didn’t get any screen aasking to select Apache. So please guide if any solution for that. The last lines i was getting are

    Running newaliases
    newaliases: warning: valid_hostname: misplaced delimiter:
    newaliases: fatal: file /etc/postfix/ parameter myhostname: bad parameter value:
    dpkg: error processing package postfix (–configure):
    installed postfix package post-installation script subprocess returned error exit status 75
    Processing triggers for libc-bin (2.27-3ubuntu1) …
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    suryam@suryamubuntu:~$ sudo phpenmod mcrypt
    WARNING: Module mcrypt ini file doesn’t exist under /etc/php/7.2/mods-available
    WARNING: Module mcrypt ini file doesn’t exist under /etc/php/7.2/mods-available

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.