Archive

Posts Tagged ‘server’

How to add MySQL servers to phpMyAdmin

May 10th, 2009

Question: How do I add a server to phpMyAdmin?

Answer: Browse to your root phpMyAdmin installation.  Locate and open the config.inc.php file in a text editor.  You will see your default server listed.  (You will see the following block of code as of version 3.1.4. :

*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = ‘cookie’;
/* Server parameters */
$cfg['Servers'][$i]['host'] = ‘localhost’;
$cfg['Servers'][$i]['connect_type'] = ‘tcp’;
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = ‘mysql’;

/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = ‘32M’;
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = ‘32M’;

/* User for advanced features */
// $cfg['Servers'][$i]['controluser'] = ‘pma’;
// $cfg['Servers'][$i]['controlpass'] = ‘pmapass’;
/* Advanced phpMyAdmin features */
// $cfg['Servers'][$i]['pmadb'] = ‘phpmyadmin’;
// $cfg['Servers'][$i]['bookmarktable'] = ‘pma_bookmark’;
// $cfg['Servers'][$i]['relation'] = ‘pma_relation’;
// $cfg['Servers'][$i]['table_info'] = ‘pma_table_info’;
// $cfg['Servers'][$i]['table_coords'] = ‘pma_table_coords’;
// $cfg['Servers'][$i]['pdf_pages'] = ‘pma_pdf_pages’;
// $cfg['Servers'][$i]['column_info'] = ‘pma_column_info’;
// $cfg['Servers'][$i]['history'] = ‘pma_history’;
// $cfg['Servers'][$i]['designer_coords'] = ‘pma_designer_coords’;
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = ‘/etc/swekey-pma.conf’;

For each additional server that you wish to add, just copy this block of code and simply change the host line to the address of your mysql server.

Example: $cfg['Servers'][$i]['host'] = ‘192.168.1.110‘;

Most of the above block is commented out, so you really only need to copy the active lines.  But as you can see, there are additional options.  For example, you can add the user name and password so you don’t have to enter them every time. (NOTE: if you are using a public server, entering login info for your mysql server is not a good idea.)

Important:  When you copy the code to add extra servers, make sure you include the following line at the top of each server:

$i++;

This increases the servers array by 1 each time it loads a new server.  Otherwise only the last server in your configuration will show up.

Finally, the above code is for phpMyAdmin version 3.1.4.  You should make sure you copy the code from your configuration as it may change in subsequent versions of the software.    That’s it.  You should see the new servers in a drop down list when you reconnect to phpMyAdmin.  Enjoy!

Author: Curtis Categories: PHP/MYSQL, Web Tags: , , ,