Question

Configure phpmyadmin to communicate to remote mysql server on private network

Posted September 7, 2018 1.8k views
MySQLApachePHPUbuntu 18.04

I have 2 droplets with private networking enabled (same datacenter). Both systems are running Ubuntu 18.04. I have installed Apache and PHP on my web server. I have installed mysql on my database server. Once I install phpMyAdmin on my web server, what steps need to be taken to allow connection to the database on a remote server? I did not find any tutorials to reference this situation.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi @jgcopes,

This is entirely possible and achievable by editing some configuration settings in the phpMyAdmin config file.

The file config.inc.php contains the configuration settings for your phpMyAdmin installation. It uses an array to store sets of config options for every server it can connect to and by default there is only one, your own machine, or localhost. In order to connect to another server, you would have to add another set of config options to the config array. A set of config options would look something similar to this:

$cfg['Servers'][$i]['host']          = '';
$cfg['Servers'][$i]['port']          = '';
$cfg['Servers'][$i]['socket']        = '';
$cfg['Servers'][$i]['connect_type']  = 'tcp';
$cfg['Servers'][$i]['extension']     = 'mysql';
$cfg['Servers'][$i]['compress']      = FALSE;
$cfg['Servers'][$i]['auth_type']     = 'config';
$cfg['Servers'][$i]['user']          = 'username';
$cfg['Servers'][$i]['password']      = 'password';

Regards,
KDSys

Submit an Answer