Hi Friends, In my previous article I explained How to configure and install PhpMyAdmin. In previous post we saw PhpMyAdmin allows only to connect to localhost MySQL server because of it’s default configuration. Suppose if we have multiple database so it is very time consuming and difficult task to install PhpMyAdmin and manage it. It would be great if we have only one PhpMyAdmin to manage all databases. Just choose which server you want to connect from single PhpMyAdmin Installation. In this article I am going to explain how we can add multiple MySQL databases in single PhpMyAdmin installation.
After successfully PhpMyAdmin installation on our system we are going to manage multiple MySQL server from one phpMyadmin installation.
Before going to add multiple host make sure you have all MySQL credential like Host, IP, Port, Database Name, Database User and Database Password etc..
Than navigate to phpMyAdmin install Directory location. In my case my phpMyAdmin directory location is “/usr/share/phpMyAdmin” it is also phpMyAdmin default location.
Now go to phpMyadmin installed directory.
# cd /usr/share/phpMyAdmin # cp config.sample.inc.php config.inc.php
Please Note :- “config.sample.inc.php” file will be available below phpMyAdmin 4.0 version. If you are using above 4.0 you will need directly edit “ config.inc.php “ which is located at /etc/phpMyAdmin/ location.
Edit /usr/share/phpMyAdmin/config.inc.php – For below phpMyadmin 4.0 version.
Edit /etc/phpMyAdmin/config.inc.php – For Above phpMyadmin 4.0 version.
In my case I am using phpMyAdmin 4.0 version.
Check phpMyAdmin version
# rpm -qa | grep -i phpmyadmin phpMyAdmin-22.214.171.124-2.el6.noarch
So will need to edit /etc/phpMyAdmin/config.inc.php file.
# cd /etc/phpMyAdmin/ # vim config.inc.php
Now you will need to add the below line at the end of config.inc.php file.
#My Remote Databases $i++; $cfg['Servers'][$i]['verbose'] = 'Database-Server'; $cfg['Servers'][$i]['host'] = '192.168.0.56'; $cfg['Servers'][$i]['port'] = ''; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['auth_type'] = 'cookie';
Adding above entries in config file save it and access phpMyadmin page in web browser. You can see server choice option on the page.
Here select server name which you need to connect and access databases.
I hope this article will be helpful to add multiple MySQL databases in single phpMyAdmin installation . If you have any queries and problem please comment in comment section.