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
Comment #1
mortendk commentedComment #2
mortendk commentedAfter 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
Im pretty sure this is a temporary solution, but this at least got it to work
Comment #3
FFFFFFFab commentedThanks, I had the same issue and your solution fixed it.
Comment #4
greg.1.anderson commentedNote 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.
Comment #5
cdracars commented#2 fixed issue. Question is drush-5 "ready" for use?
Comment #6
hs@henrikstrindberg.se commentedThanks, # 2 fixed it for me too but with one more slash added near the end:
/Applications/MAMP/bin/php/php5.3.6/binphp; doshould be:
/Applications/MAMP/bin/php/php5.3.6/bin/php; doComment #7
mducharme commentedThanks for this!
Comment #8
fragje commentedThanks! #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
Comment #10
pierrelord commentedBig thanks for this.
Comment #11
squiggy commentedThank you!!! #2 and #6 fixed this for me.
Comment #12
Melissamcewen commented#2 and #6 worked for me! Thanks!
Comment #13
August1914 commentedI 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.
Comment #14
modulist commentedThanks for the #14 tip on the symlink to mysql.sock... It worked for me with drush 4.5 and MAMP 2.0.
Comment #15
Prine commentedI got around this by setting an environment variable (as specified by README.txt)
I opened my .bash_profile
sudo nano ~/.bash_profileThen entered
export DRUSH_PHP=/Applications/MAMP/bin/php/php5.2.17/bin/phpSaved, 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
Comment #16
betz commentedComment #15 did the trick, and is a cleaner solution then patching drush.
Thanks Morten and Prine
Comment #17
batigolixcreating a symlink as explained in the drush README.txt does the trick for MAMP 2 & Drush 5:
Comment #18
suntog commentedThanks for this post! This was driving me crazy. I followed the drush README.txt and reset my path in .bash_profile with this line of code:
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH"
Then I had to take the extra steps as outlined in the README.txt:
sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
Comment #19
Mark_L6n commentedI just upgraded MAMP , which currently has PHP 5.3.6, and got the error. Using drush 4.5.
Using this command fixed everything for me:
export DRUSH_PHP=/Applications/MAMP/bin/php/php5.3.6/bin/phpComment #20
ksoldink commented#15 did the trick for me! Thanks!
Comment #21
R.Hendel commentedThanks a lot for #17 :-)
Comment #22
drupalninja99 commented#18 works for me
Comment #23
Jeff Burnz commentedsuntog re #18, you rock, thanks a lot!
Comment #24
Anonymous (not verified) commentedsuntog #18. That worked perfectly. Thanks!
Comment #25
david.mccandless commented#15 worked for me as well. FYI, you can avoid closing and re-launching terminal by executing the following command after modifying your .bash_profile:
source ~/.bash_profileComment #26
jenlamptonedit: #15 does not work for drush 8.x-6.x-dev :/
Comment #27
greg.1.anderson commentedDRUSH_PHP still working for me on the latest 8.x-6.x-dev. Shell must be bash for #15 to work; other environments might have slightly different syntax for exporting environment variables.
As an alternative, you could always try:
Verify path to env with
which env.Comment #28
greg.1.anderson commentedIf you are just looking for a solution to the can't find mysql.sock problem, there could be some other cause than using the wrong php. See the accepted answer here:
http://drupal.stackexchange.com/questions/80350/unable-to-display-drush-...
Comment #29
johnatasJMO commentedThis worked for me:
sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
As shown on: http://drupal.stackexchange.com/questions/32111/get-an-error-if-i-run-th...