KwikSteps

StepsHow to Add Another Server to phpMyAdmin

by

The configuration file that comes with phpMyAdmin has only one server configured which allows you to connect to localhost server only. In this short tutorial, we will show you how to add another host to phpMyAdmin configuration file.

Article Image

Requirements

  • Linux
  • MySQL server IP
  • MySQL server username
  • MySQL server password
  • phpMyAdmin installed

Tools and commands used

  • updatedb
  • locate command
  • cp command
  • nano text editor
  • Browser

Step 1: Locate / Create phpMyAdmin configuration file (config.inc.php)

First we need to check if the file "config.inc.php" exists or not. If the file exists, we will continue with the modifications. If the file does not exist, we will create the file using a template configuration file.

The "locate" command can be used to find files and directories by name. In order to use it, we need to update files and directories names databases.

To update the databases, run the following command:

updatedb

The command might run for few minutes depending on the last time it was executed. Please wait until it is finished.

When the command is done executing, issue the following to look for phpMyAdmin configuration file.

locate config.inc.php

If the file is found, continue to step 2 to edit the file to configure the second server.

If file is not found or nothing shown by the locate command, look for the template configuration file using the locate command as follow:

locate config.sample.inc.php

Navigate to the directory where the file is found. For example, if the locate command returned the following:
/usr/share/phpmyadmin/config.sample.inc.php, then navigate to the directory by issuing the following command:

cd /usr/share/phpmyadmin

Now duplicate the template file by copying it to another name as follow:

cp config.sample.inc.php config.inc.php

The configuration file is now created and ready to be edited.

Please note:

In some phpMyAdmin distribution, the file "config.sample.inc.php" is located in another directory than the one used by the live version of phpMyAdmin. You will need to find the location of the live version of phpMyAdmin, copy the file to that location, and then issue the cp command above to duplicate it.

Step 2: Edit the configuration file (nano config.inc.php)

Use the nano command or any other editor to edit the configuration file. Type the following to edit the file:

nano config.inc.php

Now add the following lines at the end of file. Make sure to replace XXX.XXX.XXX.XXX with MySQL server IP. Leave the port empty for default value unless you have the server on different port:

$i++;
$cfg['Servers'][$i]['verbose'] = 'My Second Server';
$cfg['Servers'][$i]['host'] = 'XXX.XXX.XXX.XXX';
$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;

Press Ctrl+O and hit enter to save the file. Press Ctrl+x to exit the editor.

Step 3: Check if the configuration is successful (Browser)

To test and check if the configuration is successful, launch the browser of your choice and access phpMyAdmin. You now have the choice to choose the server as shown below:

Article Image

Or from inside phpMyAdmin as shown below:

Article Image
Comments (0)
Load comments
Post your comment
*Name:
Email:
*Comment:
Post Comment
logo203X28
Copyright © 2017
KwikSteps
- All Rights Reserved.
Thank you!
Namecheap.com