我在内容类型中添加了一个字段。因此,当试图导出配置时,会出现一个错误。
$ pwd
$ /c/xampp/htdocs/Test/docroot/sites/testone.com
$ ../../../vendor/bin/drush config:export --uri=test.com命令配置:未找到导出。Drush无法查询数据库。因此,许多命令不可用。使用--调试重新运行您的命令以查看相关的日志消息。
其他资料如下:
/c/xampp/htdocs/Test/docroot/sites/testone.com
$ ../../../vendor/bin/drush status --uri=test.com
Drupal version : 8.6.17
Site URI : test.com
DB driver : mysql
DB hostname : xxx
DB port : xxxx
DB username : xxxxxx
DB name : xxxxxx
PHP binary : C:\xampp\php\php.exe
PHP config : C:\xampp\php\php.ini
Drush script : C:/xampp/htdocs/Test/vendor/drush/drush/drush
Drush version : 9.4.0
Drush temp : C:\Users\xxxx\AppData\Local\Temp
Drush configs : C:\xampp\htdocs\Test\vendor\drush\drush/drush.yml
Drupal root : C:\xampp\htdocs\Test/docroot
Site path : sites/testone.com调试细节
/c/xampp/htdocs/Test/docroot/sites/testone.com
$ ../../../vendor/bin/drush cex -l testone.com --uri=test.com --debug
[preflight] Config paths: C:\xampp\htdocs\Test\vendor\drush\drush/drush.yml
[preflight] Alias paths: C:\xampp\htdocs\Test\docroot/drush/sites,C:/xampp/htdocs/Test/drush/sites
[preflight] Commandfile search paths: C:\xampp\htdocs\Test\vendor\drush\drush\src
[debug] Bootstrap further to find cex
[debug] Trying to bootstrap as far as we can
[bootstrap] Drush bootstrap phase: bootstrapDrupalRoot()
[bootstrap] Change working directory to C:\xampp\htdocs\Test/docroot
[bootstrap] Initialized Drupal 8.6.17 root directory at C:\xampp\htdocs\Test/docroot
[bootstrap] Drush bootstrap phase: bootstrapDrupalSite()
[bootstrap] Initialized Drupal site test.com at sites/testone.com
[bootstrap] Drush bootstrap phase: bootstrapDrupalConfiguration()
[debug] Add service modifier
[info] sql-query: SELECT 1;
[info] Executing: mysql --defaults-file="C:\\Users\\XXXXXXXX\\AppData\\Local\\Temp\\dru3652.tmp" --database=XXXX --host=XXXX --port=3306 --silent < "C:\\Users\\XXXXXXXX\\AppData\\Local\\Temp\\dru3641.tmp" > nul
[bootstrap] Drush was not able to start (bootstrap) the Drupal database.
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.
More information may be available by running `drush status`
[debug] Bootstrap phase bootstrapDrupalDatabase() failed to validate; continuing at bootstrapDrupalConfiguration()
[debug] Done with bootstrap max in Application::find(): trying to find cex again.
In Application.php line 238:
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command cex was not found. Drush was unable to query the database. As a result, many commands are unavailable. Re-r
un your command with --debug to see relevant log messages.
Exception trace:
() at C:\xampp\htdocs\Test\vendor\drush\drush\src\Application.php:238
Drush\Application->bootstrapAndFind() at C:\xampp\htdocs\Test\vendor\drush\drush\src\Application.php:191
Drush\Application->find() at C:\xampp\htdocs\Test\vendor\symfony\console\Application.php:236
Symfony\Component\Console\Application->doRun() at C:\xampp\htdocs\Test\vendor\symfony\console\Application.php:148
Symfony\Component\Console\Application->run() at C:\xampp\htdocs\Test\vendor\drush\drush\src\Runtime\Runtime.php:112
Drush\Runtime\Runtime->doRun() at C:\xampp\htdocs\Test\vendor\drush\drush\src\Runtime\Runtime.php:41
Drush\Runtime\Runtime->run() at C:\xampp\htdocs\Test\vendor\drush\drush\drush.php:66
require() at C:\xampp\htdocs\Test\vendor\drush\drush\drush:4但是当我运行drush状态命令时,它可以工作。有遗漏的地方吗?
发布于 2019-07-12 05:33:40
您的目标是多站点实例。因此,您需要添加-l选项来告诉Drush您要针对哪个站点。否则,Drush将尝试以默认站点为目标。
drush cex -l testone.com --uri=test.com--uri选项是告诉Drush使用什么基本路径,例如用于生成sitemap,当从命令行而不是在浏览器中触发代码时,sitemap并不为PHP所知。
发布于 2019-08-26 17:35:51
最后,我找到了上述"**错误: Drush无法启动(引导) Drupal数据库**“的解决方案。简而言之,drush无法与MySQL通信。
解决方案:在路径"C:\xampp\mysql\bin“中添加一个新的系统环境变量,并重新启动gitbash。然后尝试在命令上运行。它工作正常:)。希望能帮上忙。
发布于 2019-07-12 05:26:23
只有当Drush能够连接到您的站点或站点的数据库以便100%正确时,命令config:export才能工作。如果您没有连接,则报告该命令为“找不到”。
补充说:我错过了关于多站点的部分。莱曼克斯的答案要好得多。
https://drupal.stackexchange.com/questions/283358
复制相似问题