Drupal\Core\Database\ConnectionNotDefinedException: указанное подключение к базе данных не определено при запуске Drush uli

Я пытаюсь восстановить свой пароль администратора в Drupal с помощью Drush. Я успешно установил Drush, но каждый раз, когда я запускаю drush uli, а также подобные команды, я получаю эту ошибку:

Drupal\Core\Database\ConnectionNotDefinedException: The specified database connection is not defined: default in                                         [error]
/Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Core/Database/Database.php:361
Stack trace:
#0 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Core/Database/Database.php(166):
Drupal\Core\Database\Database::openConnection('default', 'default')
#1 [internal function]: Drupal\Core\Database\Database::getConnection('default')
#2 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(254): call_user_func_array(Array,
Array)
#3 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(177):
Drupal\Component\DependencyInjection\Container->createService(Array, 'database')
#4 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(494):
Drupal\Component\DependencyInjection\Container->get('database', 1)
#5 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(236):
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#6 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(177):
Drupal\Component\DependencyInjection\Container->createService(Array, 'cache.backend.d...')
#7 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php(85):
Drupal\Component\DependencyInjection\Container->get('cache.backend.d...')
#8 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Core/Cache/CacheFactory.php(79):
Drupal\Core\Cache\ChainedFastBackendFactory->get('bootstrap')
#9 [internal function]: Drupal\Core\Cache\CacheFactory->get('bootstrap')
#10 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(254): call_user_func_array(Array,
Array)
#11 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(177):
Drupal\Component\DependencyInjection\Container->createService(Array, 'cache.bootstrap')
#12 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(494):
Drupal\Component\DependencyInjection\Container->get('cache.bootstrap', 1)
#13 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(236):
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#14 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Component/DependencyInjection/Container.php(177):
Drupal\Component\DependencyInjection\Container->createService(Array, 'module_handler')
#15 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Core/DrupalKernel.php(520):
Drupal\Component\DependencyInjection\Container->get('module_handler')
#16 /Users/myusername/.kalabox/apps/canchascrd8/code/core/lib/Drupal/Core/DrupalKernel.php(678):
Drupal\Core\DrupalKernel->preHandle(Object(Symfony\Component\HttpFoundation\Request))
#17 /usr/local/Cellar/drush/8.1.3/libexec/lib/Drush/Boot/DrupalBoot8.php(150):
Drupal\Core\DrupalKernel->prepareLegacyRequest(Object(Symfony\Component\HttpFoundation\Request))
#18 /usr/local/Cellar/drush/8.1.3/libexec/includes/bootstrap.inc(354): Drush\Boot\DrupalBoot8->bootstrap_drupal_full()
#19 /usr/local/Cellar/drush/8.1.3/libexec/commands/user/user.drush.inc(389): drush_bootstrap(5)
#20 /usr/local/Cellar/drush/8.1.3/libexec/includes/command.inc(373): drush_user_login()
#21 /usr/local/Cellar/drush/8.1.3/libexec/includes/command.inc(224): _drush_invoke_hooks(Array, Array)
#22 /usr/local/Cellar/drush/8.1.3/libexec/includes/command.inc(192): drush_command()
#23 /usr/local/Cellar/drush/8.1.3/libexec/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#24 /usr/local/Cellar/drush/8.1.3/libexec/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#25 /usr/local/Cellar/drush/8.1.3/libexec/drush.php(12): drush_main()

Я использую Kalabox и новичок в Drupal. У кого-нибудь есть идеи?


person Jonathan    schedule 12.09.2016    source источник


Ответы (1)


Если вы используете Kalabox, вам нужно использовать kbox drush uli (не drush uli) где-то внутри папки приложений.

Вы также захотите убедиться,

  1. Ваше приложение на самом деле включено
  2. Вы фактически настроили сайт Drupal (он же создал базу данных)
  3. Вы не отредактировали pantheon.settings.php, чтобы удалить логику, которая получает информацию о подключении к вашей базе данных из файла envvar PRESSFLOW_SETTINGS.

Возможно, стоит либо уничтожить и воссоздать сайт в Kalabox, либо запустить другой сайт в Pantheon и отключить его для устранения неполадок.

person Mike Pirog    schedule 14.09.2016
comment
Спасибо за ответ Майк. Kalabox в конечном итоге доставил мне столько хлопот, что я просто бросил его и пошел с MAMP, и теперь все работает. - person Jonathan; 16.09.2016