mpavlovic89
mpavlovic89

Reputation: 769

Connect local phpMyAdmin with remote server - error #2002

I have been searching for a right answer and no luck with solutions. I have WampServer and phpMyAdmin on my localhost. I have created a user in phpmyadmin on remote server with all privilages.

And tried to connect it to the remote databases with the following code:

<?php
$i++;
/* Authentication type */
$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

$i++;
/* Authentication type */
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'username';
$cfg['Servers'][$i]['password'] = 'mypass';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'example.com';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
?>

And, as a result, in phpMyAdmin now I have 2nd server, but when I choose it - an error pops-up. MySQL error #2002 that looks like this:

2002 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. The server is not responding (or the local server's socket is not correctly configured).

Please help what am I missing!

Upvotes: 2

Views: 3974

Answers (2)

Marco Aur&#233;lio Deleu
Marco Aur&#233;lio Deleu

Reputation: 4367

You are suffering from a failure of communication between your machine and the server. If it was permission, you wouldn't get a dead request, you would get the permission error.

  • Make sure your domain is available (connect to the address and get an answer somehow);
  • Make sure your firewall has the proper port open. This can be tricky since you can use one port for entering the server and a different port for the service. Make sure your firewall rule is correctly written in a way that it allows your machine to use an external port to find the right internal service.
  • Use INCORRECT username and password. When you solve this #2002 error, you will get a #1045 access denied error. Then you'll know that you need to be worrying about permission and grant IP access.
  • Make sure your local Wamp has sockets available for PhpMyAdmin to establish the connection.
  • Make sure your remote MySQL allows remote connections

Upvotes: 2

lukesUbuntu
lukesUbuntu

Reputation: 517

You have 2 connections listed there so it will show 2 connections.

So for your current config the 2nd server listed is trying to connect to "example.com" server if you are trying to connect to this server make sure you have allowed remote connection's set up, and account privileges also for remote access.

If your not trying to connect to "example.com" change these lines to the remote host you want to connect to.

$cfg['Servers'][$i]['user'] = 'username';
$cfg['Servers'][$i]['password'] = 'mypass';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'example.com';

You may need to add in port as well

$cfg['Servers'][$i]['port'] = '3307'; // MySQL port

Upvotes: 0

Related Questions