Can I specify a host when entering phpMyAdmin?

I am wondering if it is possible to specify the host on the login screen in phpMyAdmin.

When I need to connect to another server, I need to edit the host field in config.inc.php .

+6
source share
2 answers

Take a look at this:

 http://www.onlinehowto.net/config-multiple-servers-in-phpmyadmin/1405 /* Single server config section */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'dbsub'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it */ $cfg['Servers'][$i]['extension'] = 'mysql'; 

Above six lines of code, configure PhpMyAdmin to connect to a single server. Note the i> variable, which is incremented in the first line of $ i ++. To define another server, you need to copy the block insert above and change the host name. It is very important that you have a $ i ++ statement before each database server configuration. Servers can also be from different types of database. For example, MySQL and PostgreSQL. This is why PhpMyAdmin is so popular and loved.

Here is a working setup in one of the phpmyadmin instances that we control

 /* * Servers configuration */ $i = 0; /* * First server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'db'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it */ $cfg['Servers'][$i]['extension'] = 'mysql'; /* * Second server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'dbsub'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it */ $cfg['Servers'][$i]['extension'] = 'mysql'; /* * Third server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'stats1'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it */ $cfg['Servers'][$i]['extension'] = 'mysql'; $cfg['DisplayServersList'] = TRUE; /* * End of servers configuration 

The final change that will make the server list in a good drop-down list in scree for login is $ cfg ['' DisplayServersList '] = TRUE; expression. Thus, when you go to the phpmyadmin login page, you will need to select the server on which you want to work.

+15
source

At the root of your PHPMyAdmin, you have a file called config.sample.inc.php .

Rename it to config.inc.php and edit it!

Locate the first server and $ cfg ['Servers] [$ i] [' host '] for the correct value.

 /* * First server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = '192.168.0.1'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = false; 
+2
source

Source: https://habr.com/ru/post/914828/


All Articles