Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My phpmyadmin works only when I'm connected to the internet.(it even works if i'm just connected to Lan) otherwise, it gives below

error:

Error
MySQL said:  
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

Any thoughts. I've already searched this problem on google and tried all generic solutions such as editing mysql ini file, changing socket property etc. Either i'm not setting it right or something else needs to be done. I have wamp.

share

migration rejected from stackoverflow.com Aug 14 '13 at 20:50

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Tom O'Connor Aug 14 '13 at 20:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Tom O'Connor
If this question can be reworded to fit the rules in the help center, please edit the question.

3  
This is not a programming question. –  Jonathon Reinhart Nov 17 '11 at 3:28
    
If this is on windows, it is better to connect over a network connection instead of using a socket. –  F21 Nov 17 '11 at 3:30
    
@JonathonReinhart .. who said it is? –  Rahul Nov 17 '11 at 13:12
    
@phpdev how do i change the connection to network instead of socket? thx –  Rahul Nov 17 '11 at 13:14

3 Answers 3

Your configuration file is wrong, at least according to the PHPMyAdmin manual:

The $cfg['Servers'] array starts with $cfg'Servers'. Do not use $cfg['Servers'][0]. If you want more than one server, just copy following section (including $i incrementation) serveral times. There is no need to define full server array, just define values you need to change.

In your case, please try:

$cfg['Servers'][1]['host'] = 'localhost';
$cfg['Servers'][1]['port'] = '';
$cfg['Servers'][1]['socket'] = '';
$cfg['Servers'][1]['connect_type'] = 'tcp';
$cfg['Servers'][1]['auth_type'] = 'config';

Then modify your mysql configuration (my.cnf) to use TCP instead of name pipes or sorckets:

[client]
port=3306 # Keep this the same port as the one under mysqld below.

[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306 # NOTE: Do not change this if wamp has a default value for it. Instead change the port setting in the PHPMyadmin config.

Then remove any configuration for using sockets or named pipes. Reboot the server and try again to see if it worked.

share
    
actually it is using the servers[1] by doing $i = 0; $i++; in script before using $i. And i have removed the socket setting from my.ini but it still gives the same error message –  Rahul Nov 18 '11 at 2:16
    
here are my my.ini file values # The following options will be passed to all MySQL clients [client] #password = 2222 port = 3306 # The MySQL server [wampmysqld] port = 3306 #socket = C:/wamp/tmp/mysql.sock key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M basedir=c:/wamp/bin/mysql/mysql5.5.16 log-error=c:/wamp/logs/mysql.log datadir=c:/wamp/bin/mysql/mysql5.5.16/data –  Rahul Nov 18 '11 at 2:23
    
#skip-networking #enable-named-pipe –  Rahul Nov 18 '11 at 2:24
    
[mysqld] port=3306 –  Rahul Nov 18 '11 at 2:24

Explanation suggests that php is trying to contact MySQL on LAN IP and hence when LAN is not present it is not working. Try looking at settings in PHP or phpMyAdmin where IPs are mentioned to ensure they are not LAN IPs. You should use 127.0.0.1 which is always available even when you are not connected to LAN.

You can also use 'netstat -a' command to see IPs/ports on which MySQL is listening and also IP/Port on which connects.

PS: netstat command works in windows cmd

share

Hey I know you probably don't check this anymore, but go onto your alias for phpmyadmin (C:\wamp\alias\phpmyadminX.X.X) and look there.

If it says:

<Directory "c:/Public/wamp/apps/phpmyadminX.X.X"/>

Take away the / in X.X.X"/>. That was bugging me so much! Also, check to see if in the alias if its connected to the right X.X.X in phpmyadminX.X.X!

Hope this helped!

share
    
Sorry, I don't understand. Could you try to edit your answer to clarify? –  vonbrand Mar 7 '13 at 2:10

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