Download & Extend

mamp 2.0 drush cant fint mysql.sock

Project:Drush
Version:7.x-4.4
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

upgraded mamp to mamp 2.0 and now drush cant find the database

> drush st
PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in [warning]
drush_valid_db_credentials() (line 1234 of /Users/mortendk/drush/includes/environment.inc).
Drupal version : 7.4
Site URI : http://drupal7.local
Database driver : mysql
Database hostname : localhost
Database username : root
Database name : drupal7
Default theme : garland
Administration theme : garland
PHP configuration :
Drush version : 4.4
Drush configuration :
Drush alias files :
Drupal root : /Users/mortendk/Dropbox/websites/drupal7
Site path : sites/drupal7.local
File directory path : sites/drupal7.local/files

beeing a total noob with this area of webdevelopment, can someone point me in the right direction ?
i tried:
> drush fix this problem for me
command but it didnt work ;)

cheers

Comments

#1

Title:mamp 2.0 = no database connection » mamp 2.0 drush cant fint mysql.sock

#2

After digging down into drush i found out that its not looking the right places for the php stuff

mamp changed the directories so to fix this asap i added
/Applications/MAMP/bin/php/php5.2.17/bin/php
/Applications/MAMP/bin/php/php5.3.6/bin/php
to drush/drush

#  for amp_php in /Applications/MAMP/bin/php5/bin/php /Applications/MAMP/bin/php5.2/bin/php /Applications/MAMP/bin/php5.3/bin/php /opt/lampp/bin/php /Applications/xampp/xamppfiles/bin/php /Applications/acquia-drupal/php/bin/php; do

#  for amp_php in /Applications/MAMP/bin/php5/bin/php /Applications/MAMP/bin/php5.2/bin/php /Applications/MAMP/bin/php5.3/bin/php /opt/lampp/bin/php /Applications/xampp/xamppfiles/bin/php /Applications/acquia-drupal/php/bin/php /Applications/MAMP/bin/php/php5.2.17/bin/php /Applications/MAMP/bin/php/php5.3.6/binphp; do

Im pretty sure this is a temporary solution, but this at least got it to work

#3

Thanks, I had the same issue and your solution fixed it.

#4

Status:active» fixed

Note that in drush-5, the special handling of *AMP as shown above was removed. See the README.text in drush-5 for configuring drush on *AMP for the latest version of drush.

#5

#2 fixed issue. Question is drush-5 "ready" for use?

#6

Thanks, # 2 fixed it for me too but with one more slash added near the end:
/Applications/MAMP/bin/php/php5.3.6/binphp; do
should be:
/Applications/MAMP/bin/php/php5.3.6/bin/php; do

#7

Thanks for this!

#8

Thanks! #2 and #6 (small spelling correction) fixed it for me. I guess this is the price of a early upgrade to Lion and MAMP 2.0

#9

Status:fixed» closed (fixed)

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

#10

Big thanks for this.

#11

Thank you!!! #2 and #6 fixed this for me.

#12

#2 and #6 worked for me! Thanks!

#13

I also needed #2 and #6 to get Drush 4.5 working under my MAMP 2.0 installation, but I also needed to tell drush where to look for mysql, (specifically, mysql.sock); there are various ways to do this; I accomplished this by creating a sym link, per:
https://drupal.org/node/251837#comment-906520

Thanks, all.

#14

Thanks for the #14 tip on the symlink to mysql.sock... It worked for me with drush 4.5 and MAMP 2.0.

#15

I got around this by setting an environment variable (as specified by README.txt)

- If you want to run drush with a specific version of php, rather than the
one found by the drush command, you can define an environment variable
DRUSH_PHP that points to the php to execute:
export DRUSH_PHP=/usr/bin/php5

I opened my .bash_profile

sudo nano ~/.bash_profile

Then entered

export DRUSH_PHP=/Applications/MAMP/bin/php/php5.2.17/bin/php

Saved, closed terminal then launched terminal (important!) to load new changes.

NOTE: You can specify which flavour of php you wish to use by changing the path to desired php version. Above points to 5.2. MAMP comes packed with both 5.2 and 5.3

#16

Comment #15 did the trick, and is a cleaner solution then patching drush.
Thanks Morten and Prine

nobody click here