Can't start phpmyadmin. Keep getting the #2002 socket error

I've been trying to set mysql and phpMyAdmin for the last 12 hours, without any success. I've tried everything - from changing the

$cfg['Servers'][$i]['port']

in the config.inc.php file to 3306, 127.0.0.1....

typing the socket path in the config.inc.php file - both "tmp/mysql.php" and the "/var/mysql/mysql.sock".

I've tried changing the socket path in the my.cnf file and the php.ini....but I keep getting the same error

#2002 - No such file or directory
The server is not responding (or the local server's socket is not correctly configured).


I'm using MySQL 5.1.65

PhpMyAdmin 3.5.2.2.

PHP 5.3.8


PLEASE, anybody tell me what am I doing wrong here? I'm stuck and frustrated....

Thanks in advance.

Mac OS X (10.6.8)

Posted on Aug 26, 2012 3:15 PM

Reply
9 replies

Aug 28, 2012 11:33 AM in response to etresoft

Hi. Thanks for the tip. I followed the instructions and everything but I kept getting the 2002 socket error. ...I have no idea why. I'm just getting started with php and although I spent hours and hours looking for a solution, reading docs and forums, I just couldn't fix it.

So finally I decided to reinstall my Mac and upgrade to Mountain Lion - then started again from the beginning. And finally - it WORKED!

The only different thing I did this time was to type in those two lines in the Terminal before setting up the php server:


sudo mkdir /var/mysql


sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock


Maybe this was the key...I guess I'll figure it out when I become a php master:)



Aug 28, 2012 1:11 PM in response to gingerdrops

Sorry, but that is just a hack that will fail when you reboot.


I think you may be going too quickly. Get the web server setup and running. Install PHP. Install MySQL and verify that works. Make sure PHP and MySQL agree on the socket port. Only then install phpMyAdmin and make sure it is using the correct socket port too. I think that is where your problem lies.

May 1, 2013 11:58 AM in response to gingerdrops

Sets the type of connection to 'http' solved the problem for me, example of my config.inc.php:


$cfg['Servers'][$i]['verbose'] = '';

$cfg['Servers'][$i]['host'] = 'localhost';

$cfg['Servers'][$i]['port'] = '3306';

$cfg['Servers'][$i]['socket'] = '/opt/local/var/run/mysql55/mysqld.sock';

$cfg['Servers'][$i]['connect_type'] = 'http';

$cfg['Servers'][$i]['extension'] = 'mysqli';

$cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['user'] = '<your mysql username here>';

$cfg['Servers'][$i]['password'] = '<your password here>';

Mar 1, 2014 9:22 AM in response to gingerdrops

Because I was using MAMP and now trying to use OS X Server only and postgreSQL thought after having lost an hour on the matter to explain the configuration I have to cross link OS X Server PHP to MAMP's mySQL :


To avoid conflict you need to set MAMP's apache port to something else OS X Server websites.

Thus by doing so you must allow remote access to mySQL.

Default parameters would then be :

host : localhost

port : 3306 or other if specified

socket : /Applications/MAMP/tmp/mysql/mysql.sock

connection type : socket


Which worked absolutely fine using :

<?php

var_dump(new mysqli('localhost','user','password','database',3306,'/Applications/MAMP/tmp/mysql/mysql.sock'));

?>


With phpMyAdmin consider installing another instance else where and be aware of cookies issues test with a dummy.php file that it works thus if you get a #2002 error delete the cookie...


When I get rid of MAMP I'll go straight to the MySQL Community Server and fetch the latest DMG Archive.

Mar 1, 2014 11:45 AM in response to LLange

Same old story. You can get pretty much any configuration to run. You just have to figure out how OS X Server is configured, what settings MAMP is using, etc. and adjust them all so that they will talk to each other. There isn't a wrong answer per se, as long as you get it to work. The key part is to understand why so you don't have to reinvent the wheel each time you port to a different server.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Can't start phpmyadmin. Keep getting the #2002 socket error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.