I added another server with mysql server in the same network and I want phpmyadmin link to external mysql server by edit config file in /etc/phpmyadmin/conf.d/01-localhost.php and change host]=localhost to mysql server ip address but phpmyadmin still link to localhost.
Here’s my code for connecting to remote database server. First, you need to create 02-remote-db.php and tweak some code. It will give you drop down options in PHPmyAdmin to choose localhost or your DB Server.
sudo nano /etc/phpmyadmin/conf.d/02-remote-db.php
<?php
// In /etc/phpmyadmin/conf.d/02-remote-db.php
// Assumes $i from /etc/phpmyadmin/config.inc.php is available and correctly incremented.
// After 01-localhost.php (which used $i=1) and $i++ in main config, $i should now be 2.
$cfg['Servers'][$i]['host'] = 'YOUR DB IP';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['verbose'] = 'Remote DB (YOUR DB IP)';
$cfg['Servers'][$i]['hide_db'] = 'information_schema|performance_schema|mysql|sys';
?>