I've got what's probably a very easy question to solve, but I've been stuck on it for a few days now.

I've got 3 servers running in a small network, DNS, HTTP and MySQL. I've got apache2 and PHP5 installed on the HTTP server and MySQL on the MySQL server. I'm trying to install phpmyadmin on the apache2 server but when I try, I get error 2002 (hy000) because /var/lib/mysql/mysql.sock cannot be found, obviously because it isn't installed on that server.

I understand phpmyadmin requires both apache2 and MySQL to run, however, is there a way I can install it on either server while still keeping the servers separated? Ideally on the apache2.


phpmyadmin should run on the server that has Apache2 and PHP running, but it is able to connect to an external database server. Answer taken from here:

In the config file, change the "host" variable to point to the external server. The config file is called config.inc.php and it will be in the main phpMyAdmin folder. There should be a line like this:

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

Just change localhost to your server's IP address.

  • +1, anyway to make this work also the MySQL server should be configured to accept external connections – kos Apr 10 '15 at 10:18
  • And what if I have a db on localhost and about 15 other mysql db server? – s1mmel Apr 10 '15 at 11:44
  • @s1mmel You can tweak the config file to control multiple servers, as described here. – Jos Apr 10 '15 at 11:51
  • I've tried that but having trouble accessing it. I've added GRANT ALL PRIVILEGES ON *.* TO 'httpserver'@'' IDENTIFIED BY 'PASSWORD'; on the mysql. Also edited /etc/apache2/apache2.conf and added Include /etc/phpmyadmin/apache.conf to the file. Restarted both servers however I still can't access myphpadmin from Am I doing something stupid here and missing something out? – Xiah Apr 10 '15 at 12:03
  • 1
    dank u well jos :-) – s1mmel Apr 10 '15 at 12:19

I did manage to fix it. From a basic install of phpmyadmin these are the steps to allow remote connection. If anyone ever needs it

  1. Code out

    $cfg['Servers'][$i]['controluser'] = $dbuser;
    $cfg['Servers'][$i]['controlpass'] = $dbpass;
  2. Edit /etc/phpmyadmin/apache.conf is the machine you want to access the myphpadmin website from

    Order Deny, Allow
    Deny from all
    Allow from
    Allow from
  3. Edit and change /etc/my.cnf

    This allows any machine on the network to connect to the mysql

    bind-address =
  4. edit /etc/phpmyadmin/config.inc.php put add at the bottom

    $cfg['Servers'][$i]['host'] = ''; //mysql server IP
    $cfg['Servers'][$i]['user'] = 'username'; (username you want to log into ( is the server that has phpmyadmin on)
    $cfg['Servers'][$i]['password'] = 'password'; //password
    $cfg['Servers'][$i]['auth_type'] = 'config'; // keep it as config`

This allows me to log in on my windows machine with the IP in a web browser with with the username/password combo as above.

When is accessed, this drop down menu is the addition are given with #4

I can't post the image as I don't have 10 rep points :-( but it will give you a drop down menu of users with the IP address/username set up in #4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.