I have since upgrade to MAMP 1.9 and Drush 3.3. Everything worked fine prior but now I notice I cannot perform mysqldump commands using drush sql-dump.

I get back an error sh: mysqldump:unable to find command.

I believe this is to do with where the socket for mysql is but I could be wrong. I am also getting some PDO issues at times but I will deal with that later.

Does anyone have any ideas? I am running Mamp and Apache on their default ports, not MAMP ports.

Any help would be greatly appreciated.

Files: 
CommentFileSizeAuthor
#17 mamp-sql-docs.patch739 bytesgreg.1.anderson

Comments

jaymiejones86’s picture

I may aswell add the PDO issues which may be related on second thoughts

PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)              [warning]
environment.inc:952

This appears when performing a drush status while in the root directory of a drupal install (drupal 6). That message comes up before the status information.

Chris Charlton’s picture

I saw this error too. Sometimes I forget to launch MAMP first, which may have been the case for you too? I would suggest downloading the latest Drush, even the DEV or HEAD edition.

jaymiejones86’s picture

Hi Chris,

Unfortunately all of your suggestions did not work. Really not too sure whats going on but I may believe it has something to do with MAMP's configuration of MySQL. But I thought that Drush should be able to find the location of these required scripts, eg like mysqldump.

fallsemo’s picture

Based on that error message, I would create a sym from that directory to the location of MAMP's mysql.sock
See: https://drupal.org/node/251837#comment-906520

jaymiejones86’s picture

Thanks fallsemo. That fixed that issue but I still cannot perform a drush sql-dump > example.sql as even with the symlink, MySQL cannot find mysqldump...anyone else have any ideas? I know I can always use backup and migrate but this still could become an issue with other things later on. Hopefully there will be a fix for something like this in Drush someday...

greg.1.anderson’s picture

It's the shell that can't find mysqldump, not MySQL. Make sure that the executable is in your PATH.

jaymiejones86’s picture

Thanks greg.1.anderson. How would I go about that the best way?

greg.1.anderson’s picture

In .bash_profile:

PATH=$PATH:/path/to/folder/containing/mysqldump
export PATH
jaymiejones86’s picture

Thanks again greg.1.anderson but still getting the error:
sh: mysqldump:unable to find command.

I tried everything to make sure it was there but still didnt help...hmmm back to the drawing board.

jaymiejones86’s picture

Thanks again greg.1.anderson but still getting the error:
sh: mysqldump:unable to find command.

I tried everything to make sure it was there but still didnt help...hmmm back to the drawing board.

moshe weitzman’s picture

Status:Active» Closed (fixed)

at this point, drush is not the issue. closing.

jwhat’s picture

Title:Mac Mamp MySQL: add documentation to help people who are having trouble with their mysql socket on Macs» Mac Mamp MySQL
Version:» All-versions-3.3
Component:Documentation» Miscellaneous
Category:task» support

This worked, thanks.

The actual command I used was:
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

benleivian’s picture

Thanks jwhat, I got mine to work via:
sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

lucor’s picture

#13 works for me. Thanks!

rump’s picture

#13 works!

joshmiller’s picture

#13 worked :) Thank God!

greg.1.anderson’s picture

Title:Mac Mamp MySQL» Mac Mamp MySQL: add documentation to help people who are having trouble with their mysql socket on Macs
Version:All-versions-3.3»
Component:Miscellaneous» Documentation
Category:support» task
Status:Closed (fixed)» Needs review
StatusFileSize
new739 bytes

#13 is based off of the post referenced in #4, which is from 2008, but we still have a steady stream of people coming to this issue from google to solve their problems. Maybe a couple of lines in README.txt would be in order?

Patch attached.

moshe weitzman’s picture

For Drupal 7, we just added support for an alternate location for your unix socket. we might want to mention that too, but this topic gets complex quickly so perhaps the patch is fine as is.

johnnydarkko’s picture

Thanks belleivian! worked for me! Also fixed another issue I was having: I was running drush cc all and it kept on saying that I needed a higher bootstrap. After I used your solution, everything seems to be cleared up now. THANKS AGAIN!

moshe weitzman’s picture

Status:Needs review» Fixed

Committed to master. Does not apply cleanly to 4.x

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

cedewey’s picture

fyi- for those running into similar problems with XAMPP on MAC OSX, run these corresponding commands

sudo mkdir /var/mysql
sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock /var/mysql/mysql.sock
mahtoranjeet’s picture

Title:Mac Mamp MySQL» Mac Mamp MySQL: add documentation to help people who are having trouble with their mysql socket on Macs
Version:All-versions-3.3»
Component:Miscellaneous» Documentation
Category:support» task

For MAMP below commands working fine for me
sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock