使用Mysql复制安装Drupal 8

时间:2017-12-13 02:42:35

标签: mysql drupal drupal-8

我正在尝试使用Compose.io中的Mysql服务 默认情况下,此服务具有复制(3个节点) 当我尝试通过Drush或WebUI安装Drupal时,我遇到了一些错误:

Failed to INSERT a value into a test table on your database server. We tried inserting a value with the command INSERT INTO {drupal_install_test} (id) VALUES (1) and the server reported the following error: SQLSTATE[HY000]: General error: 3098 The table does not comply with the requirements by an external plugin.: INSERT INTO {drupal_install_test} (id) VALUES (1); Array ( ) .

Failed to UPDATE a value in a test table on your database server. We tried updating a value with the command UPDATE {drupal_install_test} SET id = 2 and the server reported the following error: SQLSTATE[HY000]: General error: 3098 The table does not comply with the requirements by an external plugin.: UPDATE {drupal_install_test} SET id = 2; Array ( ) .

Failed to DELETE a value from a test table on your database server. We tried deleting a value with the command DELETE FROM {drupal_install_test} and the server reported the following error: SQLSTATE[HY000]: General error: 3098 The table does not comply with the requirements by an external plugin.: DELETE FROM {drupal_install_test}; Array ( ) .

启用复制时,每个表都需要一个主键,显然Drupal默认不添加。

是否有任何关于配置Drupal以使用带复制的Mysql数据库的解决方法?

请注意,Compose.io不会向用户公开副本,只有主副本。

2 个答案:

答案 0 :(得分:2)

这显然是新Group Replication功能返回的错误消息。

是,组复制要求所有表都有主键。

https://dev.mysql.com/doc/refman/5.7/en/group-replication-requirements.html说:

  

要由组复制的每个表必须具有已定义的主键,或等效的主键,其中等效项是非空唯一键。

不幸的是,Drupal用于测试安装的测试表没有主键(或等效键)。

这已被报告为Drupal的一个问题:https://www.drupal.org/project/drupal/issues/2856362

Drupal 8.5或更高版本可能会出现修复,但与此同时,评论者可能会在该问题中提出有用的补丁。基本上,您只需要在几个文件中将drupal_install_test表的创建更改为:

CREATE TABLE {drupal_install_test} (id INT NOT NULL PRIMARY KEY)

答案 1 :(得分:0)

轻松修复(Drupal 7)

在install.inc文件中,第307行必须更改为 创建表{drupal_install_test}(id int NOT NULL PRIMARY KEY)