View Full Version : phpMyAdmin #2002 error
gsprague
10-09-2006, 02:27 PM
Hello All,
I have just installed an Xserve with 10.4.8 and I am trying to run phpMyAdmin 2.9.0.2 but I am receiving the following error:
MySQL said:
ERROR
#2002 - The server is not responding (or local MySQL server's socket is not correctly configured).
The MySQL daemon is running fine when the server starts up. I have also set the MySQL root password. I also updated the php.ini file to reflect this and the host == localhost. I have also tried killing the current MySQL process and have started another manually, and the MySQL process starts fine. I only get this error when I am trying to access phpMyAdmin. Any ideas! I have looked in this forum and others but nothing i try seems to work.
Thank you very much!
Apple2Mac
10-11-2006, 05:23 PM
what version of PHP and mySQL are you running? Apple stock or upgraded? Also post you config.inc.php file make sure to change your passwords with xxxxxx etc.....
navaho
10-11-2006, 07:26 PM
either phpMyAdmin's config.inc.php is looking for the MySQL socket in the wrong place or your php.ini is looking for it in the wrong place. More likely the latter than the former. I'd look there first. Remember to restart Apache after you make any changes to php.ini.
gsprague
10-12-2006, 10:44 AM
PHP v5.1.6
MySQL v5.0.19
I have not made any changes to the config.inc.php except for the user and pass.
Thanks!
navaho
10-12-2006, 01:17 PM
check your my.cnf for a setting similar to the following
socket = /tmp/mysql.sock
Then php.ini for the following
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /tmp/mysql.sock
make sure that the path for the two files match
restart whichever one you make changes to(MySQL or Apache), then try it again.
navaho
10-12-2006, 01:21 PM
Oh, and if this phpmyadmin is world accessible, DO NOT put username and password in the config file. Change the config type to http and type your password each time. If you use config then anyone that ever lands on your phpmyadmin has access to your database management.
I wasn't clear after reading your first post if this was world accessible or not. If it isn't..... nevermind :)
Apple2Mac
10-12-2006, 02:31 PM
Make sure MySQL v5 is running and not the Apple stock v4
also make sure that the php.ini in PHP v5 is pointing to the correct MySQL mysql.sock
gsprague
10-12-2006, 04:49 PM
Navaho,
I do not have a my.cnf file. Should I create one?
We setup realms on our server so only admins can connect to phpmyadmin.
Apple2Mac,
I usually kill the Apple Stock v4, is there an easy to have v5 startup rather than v4?
Thank you!
navaho
10-12-2006, 05:24 PM
You should have a /Library/StartupItems/MySQLCOM/ which contains a plist file and a file named MySQLCOM. Make sure they are pointing to the 5.x version.
Easy way is to use system profiler > software > startup items. That should show you which is running
Also, take a look at /usr/local/mysql/support-files/ You'll see a number of my.cnf files. If you read those files you can see that the top of each describes what use and equipment that they were created for. Chose the one that best fits your setup and sudo cp the file as my.cnf in /etc. Edit it to make sure the socket file is where you want it to be, typically /tmp. Then restart MySQL and the socket will be where you want it to be.
You will want to make sure that the php.ini is looking for the MySQL socket in the same location. If not, you'll need to fix either the my.cnf or the php.ini.
gsprague
10-13-2006, 10:21 AM
We are running Apple Stock MySQL v5.0.19.
I do not have this directory, is there a way to create it?
/Library/StartupItems/MySQLCOM
Nor do I have:
/usr/local/mysql
However, I do have:
/usr/bin/(mysql files are located here but no file called support-files)
Thanks!
Apple2Mac
10-13-2006, 10:54 AM
To have v5 of SQL be the default and turn apples v4 edit
/etc/hostconfig
it should read
MYSQL=-NO-
MYSQLCOM=-YES-
Apple2Mac
10-13-2006, 10:58 AM
We are running Apple Stock MySQL v5.0.19.
Apple Doesn't support MySQL v5.0.19 by default so either you have to install v5 or your not running v5.....
Did you downlaod and install MySQL v5 from mysql.com?
gsprague
10-13-2006, 12:45 PM
One of our developers installed Entopy's PHP 5.1.6 which seems to install MySQL 5.0.19
I do not have a MYSQLCOM in that file only MYSQL.
navaho
10-13-2006, 12:54 PM
Well, if you've gotten MySQL from someplace other than MySQL all bets are off. I've no idea what entropy does with their packages. I'd suggest that you ask them. If they package MySQL 5 and PHP5 together shouldn't it make sense for them to work together properly? If they don't it sure makes sense to me to ask entropy.
gsprague
10-13-2006, 01:06 PM
I believe it works with client machines but I guess not with the servers. Entropy says to seek the forums for this:
"Will this run on Mac OS X Server? (a.k.a. error message Undefined symbols: _checkpw)
It should. You might need to add the MIME type mappings for the .php file extensions manually. Check the user forums."
I am lost. I don't even know where to begin or how to fix this issue. Should I download MySQL 5 from mysql and reinstall. Then try the fixes list on this page?
Thank you!
gsprague
10-13-2006, 01:37 PM
OK, I installed mysql 5.0.26. And I am seeing all the file list in this thread now. Is there a way to force MySQL v5 to start rather v4 without restarting the server.
Thanks!
Apple2Mac
10-13-2006, 05:35 PM
Now that MySQL is installed check this again....
To have v5 of SQL be the default and turn apples v4 edit
/etc/hostconfig
it should read
MYSQL=-NO-
MYSQLCOM=-YES-
gsprague
10-16-2006, 09:40 AM
Yes, MYSQLCOM is equal to YES. But do I have to restart the server for this to take affect? phpmyadmin is still not working. Maybe I need to adjust my socket paths now.
gsprague
10-16-2006, 04:54 PM
I set my.cnf, php.ini, and conf.inc.php to look for /tmp/mysql.sock
Restarted apache and mysql, still no difference. I still get the #2002 error for phpmyadmin with socket errors.
navaho
10-16-2006, 05:30 PM
Alright, let's see. Is the socket actually there? in your console ls /tmp is the mysql.sock there?
Let's see where php is looking for it. Create a file with the following code:
<?php phpinfo(); ?>
Put it in a web accessible location and call it in your browser. Scroll down to the MYSQL section.
Under MySQL Support you'll see MYSQL_SOCKET. GO past that and look a few lines down, under MySQL Directives. Look for mysql.default_socket. What value is in there?
gsprague
10-17-2006, 08:59 AM
/tmp does not have the mysql.socket
mysql.default_socket local and master value both = no value
Thanks!
navaho
10-17-2006, 12:49 PM
well, it seems to me that MySQL, if it IS running, didn't put the socket where your cnf file told it to. And php doesn't seem to know where to go looking for it. I'd say you have a lil work to do yet, but you're getting closer.
gsprague
10-17-2006, 12:58 PM
mysql.socket is located in /var/mysql/
Should I move it to /tmp, delete the file, or change all my file back to look for it in /var/mysql
Thank you!
navaho
10-17-2006, 01:10 PM
/var/mysql. Ok, edit the socket location in your php.ini to match, and restart apache. Should fix you up. Don't delete the file, then nothing can connect to MySQL until you restart it. Moving it won't work because it's an ephemeral file, it comes and goes when MySQL is stopped or started. Moving it a) won't work, and b) will be broken next time MySQL is restarted.
gsprague
10-17-2006, 02:23 PM
This is what I originally had already though. i'll try it but I don't think it will make a difference. Do I need to change my.cnf and conf.inc.php back to /var/mysql also.
Thanks!
navaho
10-17-2006, 07:39 PM
interesting I was subscribed to this thread and this morning I was not. Sorry for the delay in responding, I got no email notification.
gsprague, it doesn't matter where you put them. really, it doesn't. Simply put the socket needs to be configured to a location that mysql can write to when it starts up. Php needs to be matched so that it looks for the socket in the right location.
make sure that after you make changes that the right mysql is started. are you starting it as root? If not then it's likely not reading the right my.cnf file.
one other thing, look at the 4th line down of the phpinfo script you created. the config file path. does it say /private/etc/php.ini ? is that where your php.ini is located?
gsprague
10-18-2006, 10:14 AM
The startup MYSQLCOM = YES, so I'm assuming that v5 is starting when the system starts up, no? mysqld is running but I cannot start mysql prompt in the terminal cause I am getting socket errors here now also.
php.ini is located here:
/usr/local/php5/lib/
Thank you!
gsprague
10-20-2006, 02:10 PM
OK, i set it back to /var/mysql/mysql.socket in php.ini.
Do I need to change my.cnf and conf.inc.php back to /var/mysql also.
Thanks!
gsprague
10-23-2006, 09:11 AM
Anyone got any solutions to this #2002 error? I do not want to reinstall the whole server for this problem if i don't have to.
Thank you!
bdumes
12-04-2006, 07:02 PM
I'm wondering if you ever got this resolved, as I'm seeing the same problems...
Thanks.
Boomzilla
02-12-2007, 04:50 PM
Hey all,
I just found a quick fix that helped me. My phpinfo settings showed that the php on my box was configured '--with-mysql-sock=/var/mysql/mysql.sock'.
I simply made a symbolic link to the mysql.sock in the place where PHP was looking:
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
Hope that helps!
Boomzilla
02-12-2007, 04:57 PM
Quick update. Further reading suggests a simpler solution than the symbolic link. :)
Open up /etc/my.cnf file and edit these lines:
# The MySQL server
[mysqld]
change
socket = /tmp/mysql.sock
to
socket =/var/mysql/mysql.sock
[client]
change
socket = /tmp/mysql.sock
to
socket =/var/mysql/mysql.sock
Restart mysql and you should be good to go.
stimulatingpixel
01-01-2009, 07:33 PM
I realized this is an old post, but it's the first thing that came up when I was looking to solve the issue with phpMyAdmin giving me the #2002 socket error.
I'm setting up a new MacBook Pro with:
OS X Version 10.5.6
PHP Version 5.2.6
MySQL 5.0.67
I installed MySQL from the package provided on mysql.com. I also installed the startup item and system preference panel.
After doing the basic setup to get the web server running with php and installing the phpMyAdmin files I had to do the following to get it working. First, make sure to copy "/private/etc/php.ini.default" to "/private/etc/php.ini".
in the "/private/etc/php.ini" file, find the line:
mysql.default_socket =
and change it to:
mysql.default_socket = /private/tmp/mysql.sock
Then, restart apache with:
sudo apachectl restart
This should get you going. Apparently, the default path that php looks for the mysql.sock doesn't line up right with the way MySQL installs itself. Changing this got everything working for me.
michnaugh1
01-11-2009, 11:03 PM
Thanks a lot for taking the time to post this response. It really helped me out on something that I had been scratching my head over all day.
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.