1

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

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

安装开始,“开始 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]错误的任何想法?

4

2 回答 2

0

您使用的是什么版本的 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

于 2016-07-25T15:26:39.133 回答
0

您需要查看 MySQL 尝试创建的表,如下所示:

#2 /Users/Nicholas/dkan/webroot/includes/database/schema.inc(664): DatabaseConnection->query('CREATE TABLE {p...')

完成后,搜索具有该表名的代码,以找到设置无效架构的模块的.install文件。

很可能,有必要将其添加到字段定义中: 'not null' => TRUE,

首先检查模块的问题队列以查看它是否是已知问题,或者创建自己的问题,然后发布补丁。

就我而言,我遇到了Make Entity Path Compatible with MySQL 5.7。Panelizer 问题提到 7 月 25 日的答案不再是问题,因为它已被修复并包含在发行版中。

于 2016-10-13T16:27:45.070 回答