我正在尝试首次设置Drush。我使用Mamp和Mountain Lion。当我在终端中输入“drush”时,会出现一系列命令,因此似乎已经成功安装了Drush。
我已更改了MAMP中的默认Web目录文件夹。我有许多Drupal站点,这些站点位于Web目录中的文件夹中。因此,一个站点的URL为
我已更改了MAMP中的默认Web目录文件夹。我有许多Drupal站点,这些站点位于Web目录中的文件夹中。因此,一个站点的URL为
http://localhost:8888/omega/omegav3/
,另一个站点的URL为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的问题,但我不知道如何解决。我很新手命令行,以前从未安装过类似的东西,所以我真的很困难。
sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql
。此外,我还需要创建 sock 符号链接,可以参考 Chrisblomm 的回答:sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
。 - longboardnode