How to access remote server with local phpMyAdmin client? How to access remote server with local phpMyAdmin client? mysql mysql

How to access remote server with local phpMyAdmin client?


Just add below lines to your /etc/phpmyadmin/config.inc.php file in the bottom:

$i++;$cfg['Servers'][$i]['host'] = 'HostName:port'; //provide hostname and port if other than default$cfg['Servers'][$i]['user'] = 'userName';   //user name for your remote server$cfg['Servers'][$i]['password'] = 'Password';  //password$cfg['Servers'][$i]['auth_type'] = 'config';       // keep it as config

You will get Current Server: drop down with both 127.0.0.1 and one what you have provided with $cfg['Servers'][$i]['host'] can switch between the servers.

More Details: http://sforsuresh.in/access-remote-mysql-server-using-local-phpmyadmin/


It is certainly possible to access a remote MySQL server from a local instance of phpMyAdmin, as the other answers have pointed out. And for that to work, you have to configure the remote server's MySQL server to accept remote connections, and allow traffic through the firewall for the port number that MySQL is listening to. I prefer a slightly different solution involving SSH Tunnelling.

The following command will set up an SSH tunnel which will forward all requests made to port 3307 from your local machine to port 3306 on the remote machine:

ssh -NL 3307:localhost:3306 root@REMOTE_HOST

When prompted, you should enter the password for the root user on the remote machine. This will open the tunnel. If you want to run this in the background, you'll need to add the -f argument, and set up Passwordless SSH between your local machine and the remote machine.

After you've got the SSH tunnel working, you can add the remote server to the servers list in your local phpMyAdmin by modifying the /etc/phpmyadmin/config.inc.php file. Add the following to the end of the file:

$cfg['Servers'][$i]['verbose']       = 'Remote Server 1'; // Change this to whatever you like.$cfg['Servers'][$i]['host']          = '127.0.0.1';$cfg['Servers'][$i]['port']          = '3307';$cfg['Servers'][$i]['connect_type']  = 'tcp';$cfg['Servers'][$i]['extension']     = 'mysqli';$cfg['Servers'][$i]['compress']      = FALSE;$cfg['Servers'][$i]['auth_type']     = 'cookie';$i++;

I wrote a more in-depth blog post about exactly this, in case you need additional help.


It can be done, but you need to change the phpMyAdmin configuration, read this post:http://www.danielmois.com/article/Manage_remote_databases_from_localhost_with_phpMyAdmin

If for any reason the link dies, you can use the following steps:

  • Find phpMyAdmin's configuration file, called config.inc.php
  • Find the $cfg['Servers'][$i]['host'] variable, and set it to the IP or hostname of your remote server
  • Find the $cfg['Servers'][$i]['port'] variable, and set it to the remote mysql port. Usually this is 3306
  • Find the $cfg['Servers'][$i]['user'] and $cfg['Servers'][$i]['password'] variables and set these to your username and password for the remote server

Without proper server configuration, the connection may be slower than a local connection for example, it's would probably be slightly faster to use IP addresses instead of host names to avoid the server having to look up the IP address from the hostname.

In addition, remember that your remote database's username and password is stored in plain text when you connect like this, so you should take steps to ensure that no one can access this config file. Alternatively, you can leave the username and password variables empty to be prompted to enter them each time you log in, which is a lot more secure.