doctl-databases-sql-mode
Manage SQL modes for DigitalOcean databases
TLDR
Run a doctl databases sql-mode command with an access token
Get a MySQL database cluster's SQL modes
Overwrite a MySQL database cluster's SQL modes to the specified modes
SYNOPSIS
doctl databases <cluster-id> sql-mode get|set [<mode>] [--output <format>]
PARAMETERS
<cluster-id>
ID of the target database cluster (required positional argument)
get
Retrieve and display the current SQL mode
set
Update the SQL mode for the cluster
<mode>
New SQL mode value for set subcommand (e.g., STRICT_ALL_TABLES)
--output, -o
Output format: json, yaml, or table (default: table)
--access-token
API token for authentication (auto-detected if set)
--verbose, -v
Enable verbose logging
DESCRIPTION
doctl databases sql-mode is a subcommand of the DigitalOcean CLI tool doctl, designed to retrieve or configure SQL modes for Managed Database clusters running MySQL. SQL modes dictate MySQL server SQL syntax checking and validation rules, influencing behaviors like date handling, division by zero, and strict data insertion.
Use get to fetch the current mode of a cluster, or set to apply a new one from supported options such as DEFAULT, LEGACY, STRICT_ALL_TABLES, or TRADITIONAL. This feature provides programmatic control over database configuration without console access or restarts, aiding compliance and optimization.
Requires authentication via API token. Changes propagate to all nodes and may take minutes to activate. Ideal for DevOps workflows integrating with CI/CD pipelines.
CAVEATS
Applicable only to MySQL Managed Database clusters; mode changes take 1-5 minutes to apply cluster-wide. Not supported on PostgreSQL or other engines.
SUPPORTED MODES
DEFAULT, ERRORS, LEGACY, ORACLE, POSTGRESQL, STRICT_ALL_TABLES, STRICT_TRANS_TABLES, TRADITIONAL, ALLOW_INVALID_DATES
EXAMPLES
doctl databases db-abc123 sql-mode get
doctl databases db-abc123 sql-mode set STRICT_ALL_TABLES
doctl databases db-abc123 sql-mode get --output json
SEE ALSO
doctl(1), doctl-databases(1), mysql(1)


