Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Add Multiple Hosts in phpMyAdmin

    How to Add Multiple Hosts in phpMyAdmin

    By RahulNovember 15, 20171 Min Read

    phpMyAdmin default configuration allows to connect to local MySQL server only, But if we have multiple database server running, then it would be great if we can choose to which server we need to connect from single phpMyAdmin installation. This how-to guide will help you to add multiple database hosts in phpMyAdmin, So we can select to which database server we need to connect from the web interface.

    Advertisement

    After installing phpMyAdmin on your Linux/Windows systems, lets use this to manage multiple hosts from one phpMyAdmin install.

    First navigate to your phpMyAdmin installation directory. Directory location may be differ with your installation method. In most case we can found it on /usr/share/phpMyAdmin or /usr/share/phpmyadmin directory.

    cd /usr/share/phpmyadmin
    cp config.sample.inc.php config.inc.php
    vim config.inc.php
    

    Now add the following entries at the end of the file.

     $i++;
     $cfg['Servers'][$i]['verbose'] = 'Database Server 2';
     $cfg['Servers'][$i]['host'] = '192.168.1.102';
     $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';
     $cfg['Servers'][$i]['AllowNoPassword'] = false;
    

    After adding the above entries in the configuration file and access phpMyAdmin in a web browser and you will get an option of server choice. Select server name to which you need to connect.

    phpmyadmin-multiplehosts

    hosts mariadb MySQL phpmyadmin
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    An Introduction to the “./configure” Command: Compiling Source Code in Linux

    Getting Started with Linux Command line: The Beginning

    Backing Up Your Linux System with Rsync: A Step-by-Step Guide

    View 17 Comments

    17 Comments

    1. Vinay on December 9, 2019 8:59 am

      How to set Server Choice internally based on a URL , say for UAT I have abc.xyz.com , it should set to UAT , else prod

      Reply
    2. bobthehobo on September 30, 2019 5:37 pm

      On Ubuntu 18 this config file was under /etc/phpmyadmin/config.inc.php

      Reply
    3. Oscar on August 27, 2019 3:48 pm

      Thanks a loot, old but gold!

      Reply
    4. Raghav Bhandari on July 3, 2019 11:32 am

      Thank you , it worked.

      Reply
    5. Alejandro on October 31, 2018 3:31 pm

      Thank you Very Much from Argentina

      Reply
    6. nanumi on May 12, 2018 6:09 am

      Thanks Rahul.

      Reply
    7. Terry Wong on February 13, 2018 5:45 am

      Very clear! Thanks for your tips. It works on my localhost envrionment.

      Reply
    8. Paweł on November 15, 2017 8:46 am

      Rahul, thanks for your tutorial

      Reply
    9. Igor Michel on November 7, 2017 6:17 am

      Thank you very. It works for me..

      Reply
    10. Riz on March 28, 2017 9:28 am

      Like Irfan said, some distributions (eg. Debian or Ubuntu) store config.inc.php in /etc/phpmyadmin instead of /usr/share/phpmyadmin.

      Reply
    11. SKOH on September 30, 2015 11:06 am

      Thanks, this with IRFAN and JPACHTA comments works for me on Ubuntu

      Reply
    12. jpachta on September 17, 2015 12:03 pm

      Hi, thanks for sharing this solution. It works.
      Just remove extra white spaces in all string enclosed in apostrophes!

      Reply
    13. makinero on May 28, 2015 7:23 am

      Does not work.

      Reply
      • Rahul on June 1, 2015 4:23 pm

        Hi Makinero,

        What issue are you facing ? Which operating system are you using ?

        Reply
        • Iurie on September 16, 2015 9:17 am

          Rahul, I don’t know about other distributions, but in Ubuntu, after your instructions, it was needed to copy the config.inc.php to /etc/phpmyadmin/.


          cp /usr/share/phpmyadmin/config.inc.php /etc/phpmyadmin/
          service apache2 restart #I don't know if this is really needed

          Reply
      • carlo on October 15, 2017 9:08 am

        Good comment. Nice explanation. Nice “Roboto Slab” font btw. The sun is shining, everything is awesome. I’m not a robot!

        Reply
    14. Irfan on November 5, 2014 9:39 am

      Hi Rahul

      Thanks for your post, it is really nice and helpful.

      But i found two things while doing the same on my localhost/phpmyadmin on my ubuntu machine.

      1. The file was NOT available at the said location (/usr/share/phpMyAdmin or /usr/share/phpmyadmin). Then i created the file with the above code but nothing happened.
      2. Then i updated /etc/phpmyadmin/config.inc.php with the above code and it worked!!! 🙂

      Once again, thank you so much for your post.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Split Large Archives in Linux using the Command Line
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.