Connecting phpmyadmin to separate MySQL server

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.

2 Answers

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.

6

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

    /etc/phpmyadmin/confi.inc.php
    $cfg['Servers'][$i]['controluser'] = $dbuser;
    $cfg['Servers'][$i]['controlpass'] = $dbpass;
  2. Edit /etc/phpmyadmin/apache.conf

    10.0.0.157 is the machine you want to access the myphpadmin website from

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

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

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

    $i++;
    $cfg['Servers'][$i]['host'] = '10.0.0.40'; //mysql server IP
    $cfg['Servers'][$i]['user'] = 'username'; (username you want to log into 10.0.0.10/phpmyadmin) (10.0.0.10 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 10.0.0.157 in a web browser with 10.0.0.10/phpmyadmin with the username/password combo as above.

When 10.0.0.10/phpmyadmin 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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like