Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal 8 installation with Mysql replication

I am trying to use the Mysql service from Compose.io This service has, by default, replication (3 nodes) When I try to install Drupal through either Drush or WebUI, I get some errors:

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 ( ) .

When replication is on, every table needs to have a Primary Key, and apparently Drupal don't add those by default.

Is there any workaround on configuring Drupal to use a Mysql db with Replication on?

Note that Compose.io doesn't expose the replicas, only the master, to the user.

like image 759
André Perazzi Avatar asked Nov 27 '25 12:11

André Perazzi


1 Answers

This is apparently an error message returned by the new Group Replication feature.

Yes, Group Replication requires that all tables have a primary key.

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

Every table that is to be replicated by the group must have a defined primary key, or primary key equivalent where the equivalent is a non-null unique key.

Unfortunately, the test table Drupal uses to test installation does not have a primary key (or equivalent).

This has been reported as an issue to Drupal: https://www.drupal.org/project/drupal/issues/2856362

There might be a fix coming in Drupal 8.5 or later, but in the meantime, there could be useful patches proposed by commenters in that issue. Basically, you just need to change the creation of the drupal_install_test table in a few files to:

CREATE TABLE {drupal_install_test} (id INT NOT NULL PRIMARY KEY)
like image 126
Bill Karwin Avatar answered Nov 30 '25 06:11

Bill Karwin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!