Inuar Tech

We provide software developmentĀ tailored to your business needs

Digital Ocean – General error: 3750 Unable to create or change a table without a primary key

If you are trying to set Digital Ocean Managed Database and you need to customize the configurations to allow some specific flag. A lot of places on the internet says you cannot do it but there is a way.

DO allow you to customize configs via the API.

doctl databases configuration update DB-UUID --engine mysql --config-json '{"sql_require_primary_key": false}'

This config will fix the following error when installing software that you don’t manage the table definitions.

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 steps are the following:

1. log into your droplet install the api

snap install doctl

2. doctl auth init

It should ask you for the token, go to DO and click on API and generate a token.

3. then run your config change

doctl databases configuration update DB-UUID --engine mysql --config-json '{"sql_require_primary_key": false}'

After that almost immediately it should apply the config.

Leave a Reply

Your email address will not be published. Required fields are marked *