How to Manually Install phpMyAdmin and Link it to an External Server

How to Manually Install phpMyAdmin and Link it to an External Server

 

Sometimes you might need to install a second instance of phpMyAdmin and link it with an external server for example.

Here's an easy way on how to do that.

1. Prepare the phpMyAdmin files:

- Download phpMyAdmin in the desired directory:

wget https://files.phpmyadmin.net/phpMyAdmin/4.6.5.2/phpMyAdmin-4.6.5.2-all-languages.zip

- Unzip the archive:

unzip phpMyAdmin-4.6.5.2-all-languages.zip

- Rename the folder:

mv phpMyAdmin-4.6.5.2-all-languages phpmyadmin

- Access the folder:

cd phpmyadmin/

2. The phpMyAdmin configuration part:

- Edit the config file to update the database host:

vi config.sample.inc.php

- Then update the following line to the correct database host:

$cfg['Servers'][$i]['host'] =

- Then rename the config to:

mv config.sample.inc.php config.inc.php

3. First create VHost, I would use a simple one like:

  

    ServerName phpmyadmin.DOMAIN.com
    DocumentRoot /home/USER/phpmyadmin
    <Directory "/home/USER/phpmyadmin">
       AllowOverride All
       Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
       Require method GET POST OPTIONS
    

4. Test syntax:

httpd  -t

If you get syntax on restart:

service httpd restart

Make sure that the VHost is working!

5. Important! To be on the safe side test the installation and also add a basic 401 auth:

- Create an .htaccess file in the phpMyAdmin directory and add:

php_value session.save_handler files
php_value session.save_path /tmp

AuthType Basic
AuthName "Management"
AuthUserFil    e /home/USER/path-to-httpass-file/.htpasswd
Require valid-user

- Create valid user user:

htpasswd -c /home/user/path-to-httpass-file/.htpasswd user

This is pretty much it, you might have some issues with the DB permissions but it is a different story.

 

Coffee For Me