---
title: Global SQL Modes
url: https://docs.vultr.com/products/storage/databases/mysql/management/settings/global-sql-modes
description: A guide explaining how to configure and manage global SQL mode settings for Vultr Managed MySQL databases.
publish_date: 2024-09-23T20:21:36.748985Z
last_updated: 2026-05-26T20:35:51.845666Z
---

# How to Manage Global SQL Modes for Vultr Managed Databases for MySQL

SQL modes define the default data validation check that MySQL performs to match the application requirement. For instance, the global `NO_ZERO_DATE` mode instructs MySQL only to allow legal dates and restrict invalid values like `0000-00-00`. Each managed database can have its own set of SQL modes. Always match the managed databases' SQL modes with the development servers.

Follow this guide to manage global SQL modes for Vultr Managed Database for MySQL using Vultr Console, API, CLI, or Terraform.

=== "Vultr Console"

    1. Navigate to **Products** and select **Databases**.
    1. Click the target database instance.
    1. Click **Settings** and select **MySQL Configuration**. 
    1. Then, navigate to **Global SQL Modes**. Add or remove any mode as required

=== "Vultr API"

    1. List all the database instances by sending a `GET` request to the [**List Managed Databases** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/list-databases) and note the database ID (For example, `43b4c774-5dff-4ac0-a01f-78a23c2205b5`) and the active SQL modes.

        ```console
        $ curl "https://api.vultr.com/v2/databases" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

    1. Send a `PUT` request to the [**Update Managed Database** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/update-database) and specify the database ID to update the SQL modes.

        ```console
        $ curl "https://api.vultr.com/v2/databases/datase_id" \
            -X PUT \
            -H "Authorization: Bearer ${VULTR_API_KEY}" \
            -H "Content-Type: application/json" \
            --data '{
                "mysql_sql_modes" : [
                    "ANSI",
                    "ERROR_FOR_DIVISION_BY_ZERO",
                    "NO_ENGINE_SUBSTITUTION",
                    "NO_ZERO_DATE",
                    "NO_ZERO_IN_DATE",
                    "STRICT_ALL_TABLES",
                    "ONLY_FULL_GROUP_BY"
                ],
                "mysql_require_primary_key":true            
            }'
        ```

=== "Vultr CLI"

    1. List all database instances and note the database ID. For instance, `d6ac2a3c-92ea-43ef-8185-71a23e58ad8c`.

        ```console
        $ vultr-cli database list --summarize
        ```

    1. Specify a database ID to add a new SQL mode to the database. For instance, `ONLY_FULL_GROUP_BY`.

        ```console
        $ vultr-cli database update database_id \
        --mysql-sql-modes "ANSI,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES,ONLY_FULL_GROUP_BY" \
        --mysql-require-primary-key true
        ```

=== "Terraform"

    1. Open your Terraform configuration for the existing Managed Database for MySQL resource.

    1. Add or update the `mysql_sql_modes` and `mysql_require_primary_key` arguments.

        ```terraform
        resource "vultr_database" "mysql" {
            # ...existing fields (database_engine, region, plan, label, etc.)

            mysql_sql_modes = [
                "ANSI",
                "ERROR_FOR_DIVISION_BY_ZERO",
                "NO_ENGINE_SUBSTITUTION",
                "NO_ZERO_DATE",
                "NO_ZERO_IN_DATE",
                "STRICT_ALL_TABLES",
                "ONLY_FULL_GROUP_BY"
            ]

            mysql_require_primary_key = true
        }
        ```

    1. Apply the configuration and observe the following output:

        ```
        Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
        ```
