我試圖設置Drush第一次。我正在使用Mamp和山獅。當我在終端輸入'drush'時,我得到一個命令列表,所以它似乎已經安裝好了。Drush無法連接到MAMP上的MySQL?
我更改了MAMP的默認網頁目錄文件夾。我在Web目錄中的文件夾中有許多Drupal站點。因此,一個網站的網址是http://localhost:8888/omega/omegav3/
,另一個網址是http://localhost:8888/omega/omegav4/
通過瀏覽到終端中的站點文件夾,我可以運行Drush命令,但是出現錯誤。當我下載Views時,它確實將模塊下載到了我的sites/all/modules文件夾,但它給我一些錯誤。當我嘗試啓用模塊時,它會給我更多的錯誤,並且不會啓用模塊。
unknown:omegav3 MYUSERNAME$ cd /Users/MYUSERNAME/Dropbox/sites/omega/omegav3
unknown:omegav3 MYUSERNAME$ drush dl views
PDO::__construct(): [2002] No such file or directory (trying to connect via [warning]
unix:///var/mysql/mysql.sock) environment.inc:523
Project views (7.x-3.7) downloaded to sites/all/modules/views. [success]
Project views contains 2 modules: views, views_ui.
unknown:omegav3 MYUSERNAME$
unknown:omegav3 MYUSERNAME$ drush en views
PDO::__construct(): [2002] No such file or directory (trying to connect via [warning]
unix:///var/mysql/mysql.sock) environment.inc:523
Command pm-enable needs a higher bootstrap level to run - you will need to invoke [error]
drush from a more functional Drupal environment to run this command.
The drush command 'en views' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a configured
database. In this case you can select another site with a working database setup by
specifying the URI to use with the --uri parameter on the command line. See `drush
topic docs-aliases` for details.
* connect the database through a socket. The socket file may be wrong or the php-cli
may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for
details.
Drush was attempting to connect to:
Drupal version : 7.23
Site URI : http://default
Database driver : mysql
Database username : root
Database name : omegav3
Default theme : garland
Administration theme : garland
PHP executable : /usr/bin/php
PHP configuration :
PHP OS : Darwin
Drush version : 6.1.0
Drush configuration :
Drush alias files :
Drupal root : /Users/MYUSERNAME/Dropbox/sites/omega/omegav3
Site path : sites/default
File directory path : sites/default/files
unknown:omegav3 MYUSERNAME$
這似乎是一個問題與Drush和MySQL,但我不知道如何解決這個問題。我對命令行非常陌生,並且從未在Drush之前安裝過任何類似的軟件。
這應該被看作是* chrisblomm答案的*補充*,*不是*「它的替代品」。這是一個好主意,但它不能解決問題 - 至少,它不適合我。 –