#2002 - The server is not responding (or the local MySQL server's socket is not corre

ssgill

Verified User
Joined
May 9, 2012
Messages
168
Hello i have mysql 5.5 and phpmyadmin is giving me this error #2002 error. I am running php PHP 5.3.13 with

mysqld Ver 5.5.25-log for Linux on x86_64 (MySQL Community Server (GPL))

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

I have checked by uploading test script on the server and it execute and shows the result correctly. Only thing is that it does not connect on localhost but works on 127.0.0.1.

I have added updated phpmyadmin config file with the same.

checks
ls -la /var/lib/mysql/mysql.sock
srwxrwxrwx 1 mysql mysql 0 Jun 5 13:28 /var/lib/mysql/mysql.sock

ps ax | grep mysql
12414 pts/0 S 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/mysql/host.domain.com.pid
12492 pts/0 Sl 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/matrix2.matrixorbital.com.err --pid-file=/var/lib/mysql/host.domain.com
29536 pts/0 S+ 0:00 grep mysql

netstat -lnp | grep mysql

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 12492/mysqld
unix 2 [ ACC ] STREAM LISTENING 30655 12492/mysqld /var/lib/mysql/mysql.sock

my.cnf

[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

#skip-networking

log-bin=mysql-bin

# binary logging format - mixed recommended
binlog_format=mixed
server-id = 1
#server-id = 2
#master-host = <hostname>
#master-user = <username>
#master-password = <password>
#master-port = <port>
#log-bin=mysql-bin
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 256M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 64M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

Status from mysql command line
mysql> status
--------------
mysql Ver 14.14 Distrib 5.5.25, for Linux (x86_64) using readline 5.1

Connection id: 9
Current database:
Current user: da_admin@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.25 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 1 hour 7 min 48 sec

Threads: 1 Questions: 25 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.006
--------------

/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
2XX.XXX.XX.XXX host.domain.com

If you need more info and can dig that out to. Thanks for your time and effort.
 
It sounds odd. By googling it quickly I only read the changing it to 127.0.0.1 is a solution to the problem, but I don't see the actuall reason as of why. You would indeed think the hosts file, but that seems in place. I suppose ping localhost works?

Then there's this I got from php.net;

Whenever you specify "localhost" or "localhost:port" as server, the MySQL client library will override this and try to connect to a local socket (named pipe on Windows). If you want to use TCP/IP, use "127.0.0.1" instead of "localhost". If the MySQL client library tries to connect to the wrong local socket, you should set the correct path as in your PHP configuration and leave the server field blank.

Try a file with

<?php
phpinfo();
?>

and look for socket locations, MYSQLI_SOCKET probably in specific for phpmyadmin. See if its set to your /var/lib/mysql/mysql.sock

if that all isn't it, then for now I would say use 127.0.0.1 and maybe someone else has an suggestion.
 
Thanks Arieh, i did figured out the problem. It was because php was compiled with mysqlnd. I recompiled php without mysqlnd and its working now.

Now i have another problem its with phpmyadmin.

First i updated phpmyadmin from custombuild and it was giving me 500 error. Then i ran
phpMyAdmin.sh under scripts directory and well phpmyadmin was working but it was older version "phpMyAdmin - 2.11.11.3".

So ran ./build versions
phpMyAdmin 2.11.11.3-all-languages to 3.5.1-all-languages update is available.

So did ./build phpmyadmin
phpMyAdmin 3.5.1-all-languages installation is done.

at this point phpmyadmin stops working blank page

So did from scripts directory ./phpMyadmin.sh command executes no message.

But it somehow installs "phpMyAdmin - 2.11.11.3" and its working.

So i did ./build update_versions
Updating phpMyAdmin.
phpMyAdmin 3.5.1-all-languages installation is done.

And well phpmyadmin is again not working. Any ideas

Suphp

PHP 5.3.13 (cgi) (built: Jun 5 2012 15:36:52)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with the ionCube PHP Loader v4.2.1, Copyright (c) 2002-2012, by ionCube Ltd.
with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

Thanks
 
If you would still use mysqlnd, the solution would be very easy. I also tried mysqlnd and found out you have to specify the socket for mysqli and pdo.

mysqli.default_socket = /var/lib/mysql/mysql.sock
pdo_mysql.default_socket = /var/lib/mysql/mysql.sock

are the lines I use in php.ini.

mysql_ doesn't require it, because mysqlnd doesn't work with it (given that you had --with-mysql=/usr and --with-mysqli=mysqlnd and --with-pdo-mysql=mysqlnd)

If you want to try to fix your current setup, try looking in error logs or maybe suphp logs
 
Thanks i will try this later, for now i want to get phpmyadmin resolved. I was checking the logs but there is nothing.

i check /var/log and there is two files with suphp.log and suphp.log-20120603

custom/suphp/configure.suphp

#!/bin/sh
"./configure" \
"--prefix=/usr/local/suphp" \
"--sysconfdir=/usr/local/suphp/etc/" \
"--with-apache-user=apache" \
"--with-setid-mode=owner" \
"--with-apxs=/usr/bin/apxs" \
"--disable-checkpath"

custom/suphp/configure.php5
#!/bin/sh
"./configure" \
"--prefix=/usr/local/php5" \
"--enable-force-cgi-redirect" \
"--enable-fastcgi" \
"--with-config-file-path=/usr/local/etc/php5/cgi" \
"--with-curl=/usr/local/lib" \
"--with-gd" \
"--with-gettext" \
"--with-jpeg-dir=/usr/local/lib" \
"--with-freetype-dir=/usr/local/lib" \
"--with-kerberos" \
"--with-mcrypt" \
"--with-mhash" \
"--with-mysql=/usr" \
"--with-mysqli=/usr/bin/mysql_config" \
"--with-pcre-regex=/usr/local" \
"--with-pdo-mysql=/usr" \
"--with-pear=/usr/local/lib/php" \
"--with-png-dir=/usr/local/lib" \
"--with-zlib" \
"--with-zlib-dir=/usr/local/lib" \
"--with-openssl" \
"--with-iconv=/usr/local" \
"--enable-bcmath" \
"--enable-calendar" \
"--enable-exif" \
"--enable-ftp" \
"--enable-gd-native-ttf" \
"--enable-magic-quotes" \
"--enable-soap" \
"--enable-sockets" \
"--enable-mbstring" \
"--enable-zip" \
"--enable-wddx"

Should i try recompiling php and suphp or any change in config values is needed.
Thanks
 
Have you also checked the error logs /var/log/httpd/error or if you go to /phpmyadmin on a domain /var/log/httpd/domains/domain.tld.error.log

You could indeed go back to mysqlnd with --with-mysql=/usr and --with-mysqli=mysqlnd and --with-pdo-mysql=mysqlnd and specify the sockets.

but in either case you could try to just delete phpmyadmin from /var/www/html and just run ./build phpmyadmin again
 
Thanks Arieh, for your help. Finally got everything working.

PHP Compiled with mysqlnd
added changes in php.ini

have phpmyadmin working issue was with disable_functions. So for now have quoted that line and will check which one phpmyadmin needs.

Thanks once again for your help.
 
Back
Top