Problem/Motivation

Cannot install Honeypot.
The website gives error. - The website encountered an unexpected error. Please try again later.
Partial installation is done but the honeypot configuration link [Honeypot configuration] does not show under Configuration > Content Authoring. Although, Honeypot is present in the uninstall section and it uninstalls, alright.

The /reports/dblog/event/1420 message is
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.: CREATE TABLE "honeypot_user" ( `uid` INT unsigned NOT NULL COMMENT 'Foreign key to \"users\".uid. uniquely identifies a Drupal user to whom this ACL data applies.', `hostname` VARCHAR(128) NOT NULL COMMENT 'Hostname of user that that triggered honeypot.', `timestamp` INT unsigned NOT NULL COMMENT 'Date/time when the form submission failed, as Unix timestamp.', INDEX `uid` (`uid`), INDEX `timestamp` (`timestamp`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Table that stores failed attempts to submit a form.'; Array ( ) in Drupal\Core\Extension\ModuleInstaller->installSchema() (line 657 of /var/www/html/core/lib/Drupal/Core/Extension/ModuleInstaller.php).

Steps to reproduce

The server is on LAMP DigitalOcean with 'Managed Host' aka database is external and on a different port.

Thank you for your time and support. Kind regards.

Comments

JoAMoS created an issue. See original summary.

tr’s picture

Issue tags: -error message

This is basically a duplicate of #2943526: Missing primary key in table `honeypot_user`

The message above tells you how to work around this on your system, by setting a database configuration value.

joamos’s picture

Thank you for the reply.

Clarification - a database configuration value means - a primary key
Doubt - Why other modules do not create this error, as the db is the same.

Advice - Can un-set the 'sql_require_primary_key' then will the installation happen/complete?

Please do let me know, thanks again.

tr’s picture

Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message.

This system variable is unset by default on MySql (see https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sys...), so it doesn't cause an error on most sites. But your hosting must configure the database with non-standard values.

If you can change that system variable, that will fix the problem. But if you can't change that system variable, then you can add a primary key to the table instead. That is what is discussed in #2943526: Missing primary key in table `honeypot_user`. That issue started on Drupal 7 and hasn't been closed yet - it needs some participation from the community to determine the correct fix and to create and test patches for both Drupal 7 and Drupal 8.

I do consider this a bug, but it doesn't affect most people. I am happy to commit a fix for this, if a suitable patch is provided by the community.

tr’s picture

Status: Active » Closed (duplicate)

Marking as duplicate of #2943526: Missing primary key in table `honeypot_user`. Please participate in that issue if this problem affects you.