By ajaypatel
How to disable SQL_REQUIRE_PRIMARY_KEY in digital ocean manged database for mysql globaly?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @ajaypatel,
You can reach out to DO support to disable global sql_require_primary_key for your MySQL managed database.
If you need to disable it on session level, you can execute the below command.
SET SESSION sql_require_primary_key = 0;
I hope this helps!
Regards, Rajkishore
Hi,
Our engineer team has updated API documentation to make database configuration changes via API; you will now be able to disable sql_require_primary_key using API.
To check database configuration check the below link: https://docs.digitalocean.com/reference/api/api-reference/#operation/get_database_config
To update database configuration check the below link: https://docs.digitalocean.com/reference/api/api-reference/#operation/patch_database_config
To create “$DIGITALOCEAN_TOKEN” check the below link: https://docs.digitalocean.com/reference/api/create-personal-access-token/
To fetch “$database_cluster_uuid” check the below link: https://docs.digitalocean.com/reference/api/api-reference/#operation/list_database_clusters
You can reach out to support if you are seeing any errors while changing database configuration using API https://docs.digitalocean.com/support/
I hope this helps!
Regards, Rajkishore
Hi there,
In addition to what has already been mentioned, one option here is to use the doctl CLI.
So, to disable sql_require_primary_key in your DigitalOcean Managed MySQL database, using the doctl CLI you can run the following command:
doctl databases configuration update <database-cluster-id> --config-json '{"sql_require_primary_key": false}' --engine mysql
Replace <database-cluster-id> with your actual database cluster ID.
This command updates the database configuration to set sql_require_primary_key to false.
For more details, refer to the doctl databases configuration update documentation
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.