我正在尝试通过drush创建DKAN网站,而我目前在安装网站时遇到了一些问题。我已经下载了drush,dkan和mysql,并且mysql服务器当前正在使用版本mysql Ver 14.14 Distrib 5.7.13, for osx10.11 (x86_64) using EditLine wrapper运行。

root@localhost的mysql密码是passw0rd。然后,从dkan / webroot目录中运行命令drush site-install dkan --db-url="mysql://root:passw0rd@localhost/dkandb"

安装开始,“开始Drupal安装。这需要一段时间。”但是大约一分钟后,我得到以下异常:

exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead' in /Users/Nicholas/dkan/webroot/includes/database/database.inc:2204


以及25个项目的堆栈跟踪:

Stack trace:
#0 /Users/Nicholas/dkan/webroot/includes/database/database.inc(2204): PDOStatement->execute(Array)
#1 /Users/Nicholas/dkan/webroot/includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array)
#2 /Users/Nicholas/dkan/webroot/includes/database/schema.inc(664): DatabaseConnection->query('CREATE TABLE {p...')
#3 /Users/Nicholas/dkan/webroot/includes/database/database.inc(2753): DatabaseSchema->createTable('panelizer_entit...', Array)
#4 /Users/Nicholas/dkan/webroot/includes/common.inc(7092): db_create_table('panelizer_entit...', Array)
#5 /Users/Nicholas/dkan/webroot/includes/module.inc(479): drupal_install_schema('panelizer')
#6 /Users/Nicholas/dkan/webroot/includes/install.core.inc(1609): module_enable(Array, false)
#7 [internal function]: _install_module_batch('panelizer', 'Panelizer', Array)
#8 /Users/Nicholas/dkan/webroot/includes/batch.inc(284): call_user_func_array('_install_module...', Array)
#9 /Users/Nicholas/dkan/webroot/includes/form.inc(4714): _batch_process()
#10 /Users/Nicholas/dkan/webroot/includes/install.core.inc(444): batch_process('install.php?pro...', 'http://default/...')
#11 /Users/Nicholas/dkan/webroot/includes/install.core.inc(339): install_run_task(Array, Array)
#12 /Users/Nicholas/dkan/webroot/includes/install.core.inc(77): install_run_tasks(Array)
#13 /usr/local/Cellar/drush/HEAD-c967802/libexec/includes/drush.inc(725): install_drupal(Array)
#14 /usr/local/Cellar/drush/HEAD-c967802/libexec/includes/drush.inc(711): drush_call_user_func_array('install_drupal', Array)
#15 /usr/local/Cellar/drush/HEAD-c967802/libexec/commands/core/drupal/site_install_7.inc(82): drush_op('install_drupal', Array)
#16 /usr/local/Cellar/drush/HEAD-c967802/libexec/commands/core/site_install.drush.inc(245): drush_core_site_install_version('dkan', Array)
#17 [internal function]: drush_core_site_install('dkan')
#18 /usr/local/Cellar/drush/HEAD-c967802/libexec/includes/command.inc(366): call_user_func_array('drush_core_site...', Array)
#19 /usr/local/Cellar/drush/HEAD-c967802/libexec/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#20 [internal function]: drush_command('dkan')
#21 /usr/local/Cellar/drush/HEAD-c967802/libexec/includes/command.inc(185): call_user_func_array('drush_command', Array)
#22 /usr/local/Cellar/drush/HEAD-c967802/libexec/lib/Drush/Boot/BaseBoot.php(73): drush_dispatch(Array)
#23 /usr/local/Cellar/drush/HEAD-c967802/libexec/includes/preflight.inc(88): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#24 /usr/local/Cellar/drush/HEAD-c967802/libexec/drush.php(12): drush_main()
#25 {main}


关于如何消除SQLSTATE[42000]错误的任何想法?

最佳答案

您正在使用哪个版本的DKAN?看来在panelizer模块上安装失败。您遇到的同一件事有一个问题:https://www.drupal.org/node/2659820

您可以尝试在那里直接应用更新。

仅供参考,如果您在https://github.com/NuCivic/dkan/issues上打开票证,您将获得DKAN团队的更多直接支持。

似乎DKAN需要更新到最新版本的panelizer才能获得适用于您的错误https://github.com/NuCivic/dkan/blob/7.x-1.x/drupal-org.make#L110的修复程序,他们应该在下一个版本中

08-03 19:34