Skip to content
Advertisement

I can’t access remote mysql server via local phpmyadmin

I’m trying to access my remote mysql server via my local phpmyadmin setup(from xampp installation). Here is my config.inc.php file for phpmyadmin:

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'remote-mysql-server-username';
$cfg['Servers'][$i]['password'] = 'remote-mysql-server-pass';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true; 

// remote mysql server
$cfg['Servers'][$i]['verbose']       = 'remote mysql server';
$cfg['Servers'][$i]['host']          = 'some_website.com/';
$cfg['Servers'][$i]['port']          = '3306'; 
$cfg['Servers'][$i]['connect_type']  = 'tcp';
$cfg['Servers'][$i]['compress']      = FALSE;

I get this error:

hpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

Advertisement

Answer

the remote mysql server that you want to connect has to be configured to allow or take request other than localhost. Check firewall is allowing port 3306 (both incoming and outgoing).

Now we will escalate the situation:

1) First check in my.ini of mysql configuration the “bind-address” directive it should be 0.0.0.0 to allow connections from any IP address.

2) second the user should have all permission for the database we are accessing.

3) third make the phpmyadmin work in localhost scenario, add this in the end of your phpmyadmin config file before ?>(tag):

    /* Remote Server */
$i++;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = 'myinstance.us-1.rds.amazonaws.com';//this is example enter your address
$cfg['Servers'][$i]['verbose'] = 'Remote Server Name';
$cfg['Servers'][$i]['user'] = '**********';
$cfg['Servers'][$i]['password'] = '**********'; 

Now login in localhost and select from the current server drop down your server name, phpmyadmin will do rest of task.

Hope this will help you.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement