我使用Composer安装Drush 7,并在Windows上的XAMPP上创建了一个Drupal 8。
所有的drush命令都没有工作。所有的失败都有相同的错误:
H:\xampp\htdocs\d8_test>drush pmi
Command pm-info needs a higher bootstrap level to run - you will need [error]
to invoke drush from a more functional Drupal environment to run this
command.
The drush command 'pmi' 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 : 8.0-dev
Site URI : http://default
Database driver : mysql
Database username : root
Database name : d8_test
PHP executable : php.exe
PHP configuration : H:\xampp\php\php.ini
PHP OS : WINNT
Drush version : 7.0-dev
Drush temp : Z:\Temp
directory
Drush configuration :
Drush alias files :
Drupal root : H:/xampp/htdocs/d8_test
Site path : sites/default
Active config path : sites/default/files/config_MoeSD5C7JSguok
xrBh4-UuwT_r9_jk2Z59QKdN-j9Zx9DIgHBy2dH8n
1rGOeKNJpaAAxBi4PzA/active
Staging config path : sites/default/files/config_MoeSD5C7JSguok
xrBh4-UuwT_r9_jk2Z59QKdN-j9Zx9DIgHBy2dH8n
1rGOeKNJpaAAxBi4PzA/staging我的settings.php的内容
$databases['default']['default'] = array (
'database' => 'd8_test',
'username' => 'root',
'password' => '',
'prefix' => '',
'host' => '127.0.0.1',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);注意,我的MySQL安装主机是127.0.0.1,而不是localhost。
还请注意,H:\xampp\php\被添加到我的PATH变量中,因此php.exe引用了H:\xampp\php\php.exe。
drush sql-connect的输出如下:
mysql --用户=root--密码=--数据库=d8_test--主机=127.0.0.1--端口=3306
发布于 2014-05-24 22:15:26
drush sql-connect的输出为mysql --user=root --password= --database=d8_test --host=127.0.0.1 --port=3306。现在,当我直接执行这个命令时,它没有工作,因为系统路径中没有mysql.exe。因此,我将H:\xampp\mysql\bin添加到PATH (Windows中的环境变量),然后它就起作用了!
发布于 2014-08-02 03:05:23
确保安装了mysql客户端核心-5.5包。
关于Ubuntu:
sudo apt-get install mysql-client-core-5.5https://drupal.stackexchange.com/questions/115158
复制相似问题