Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Installing when MySQL config: sql_require_primary_key is true. #60

Closed
adrianjean opened this issue Feb 8, 2024 · 1 comment
Closed

Comments

@adrianjean
Copy link

Hello,

While installing this plugin on a new server setup, I received this error from the installer:


Migration Error: An error occurred while executing the "mutation\translate\migrations\Install migration: 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.
The SQL being executed was: CREATE TABLE message (
id int(11) NOT NULL,
dateCreated datetime(0) NOT NULL,
dateUpdated datetime(0) NOT NULL,
uid char(36) NOT NULL DEFAULT '0',
language varchar(16) NOT NULL,
translation text
) CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB

The key part being:

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.

I use a DigitalOcean Managed Database and can request that they manually set sql_require_primary_key to false so I can install this plugin, but this apparently has other implications with respect to replication, performance, etc.

At one point it seems CraftCMS core had this same issue and it was resolved in a fix in version 4.2.5 (Link)

Any chance you could also apply a similar fix?

@smcyr
Copy link
Contributor

smcyr commented Feb 16, 2024

I fixed the error the same as CraftCMS in version 3.2.1. Let me know if it doesn't work for you. Thanks

@smcyr smcyr closed this as completed Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants