This page describes how to configure database flags for Cloud SQL, and
lists the flags that you can set for your instance. You use database flags
for many operations, including adjusting MySQL parameters, adjusting
options, and configuring and tuning an instance.
In some cases, setting
one flag may require that you set another flag to fully enable the
functionality you want to use. For example, to enable
slow query logging,
you must set both the slow_query_log flag to on and the log_output flag
to FILE to make your logs available using the Google Cloud console Logs Explorer.
When you set, remove, or modify a flag for a database instance, the database
might be restarted. The flag value is then persisted for the instance until you
remove it. If the instance is the source of a replica, and the instance is
restarted, the replica is also restarted to align with the current configuration
of the instance.
Configure database flags
The following sections cover common flag management tasks.
Set a database flag
Console
In the Google Cloud console,
select the project that contains the Cloud SQL instance for which you want to set a database flag.
Open the instance and click Edit.
Go to the Flags section.
To set a flag that has not been set on the instance before, click
Add item, choose the flag from the drop-down menu, and set its value.
Click Save to save your changes.
Confirm your changes under Flags on the Overview page.
This command will overwrite all database flags
previously set. To keep those and add new ones, include the values for all
flags you want set on the instance; any flag not specifically included is
set to its default value. For flags that don't take a value, specify the
flag name followed by an equals sign ("=").
For example, to set the general_log,
skip_show_database, and wait_timeout flags, you
can use the following command:
resource "google_sql_database_instance" "instance" {
database_version = "MYSQL_8_0"
name = "mysql-instance"
region = "us-central1"
settings {
database_flags {
name = "general_log"
value = "on"
}
database_flags {
name = "skip_show_database"
value = "on"
}
database_flags {
name = "wait_timeout"
value = "200000"
}
disk_type = "PD_SSD"
tier = "db-n1-standard-2"
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
Apply the changes
To apply your Terraform configuration in a Google Cloud project, complete the steps in the
following sections.
Set the default Google Cloud project
where you want to apply your Terraform configurations.
You only need to run this command once per project, and you can run it in any directory.
export GOOGLE_CLOUD_PROJECT=PROJECT_ID
Environment variables are overridden if you set explicit values in the Terraform
configuration file.
Prepare the directory
Each Terraform configuration file must have its own directory (also
called a root module).
In Cloud Shell, create a directory and a new
file within that directory. The filename must have the
.tf extension—for example main.tf. In this
tutorial, the file is referred to as main.tf.
mkdir DIRECTORY && cd DIRECTORY && touch main.tf
If you are following a tutorial, you can copy the sample code in each section or step.
Copy the sample code into the newly created main.tf.
Optionally, copy the code from GitHub. This is recommended
when the Terraform snippet is part of an end-to-end solution.
Review and modify the sample parameters to apply to your environment.
Save your changes.
Initialize Terraform. You only need to do this once per directory.
terraform init
Optionally, to use the latest Google provider version, include the -upgrade
option:
terraform init -upgrade
Apply the changes
Review the configuration and verify that the resources that Terraform is going to create or
update match your expectations:
terraform plan
Make corrections to the configuration as necessary.
Apply the Terraform configuration by running the following command and entering yes
at the prompt:
terraform apply
Wait until Terraform displays the "Apply complete!" message.
Open your Google Cloud project to view
the results. In the Google Cloud console, navigate to your resources in the UI to make sure
that Terraform has created or updated them.
Delete the changes
To delete your changes, do the following:
To disable deletion protection, in your Terraform configuration file set the
deletion_protection argument to false.
deletion_protection = "false"
Apply the updated Terraform configuration by running the following command and
entering yes at the prompt:
terraform apply
Remove resources previously applied with your Terraform configuration by running the following
command and entering yes at the prompt:
terraform destroy
REST v1
To set a flag for an existing database:
Before using any of the request data,
make the following replacements:
If there are existing flags configured for the database, modify the previous
command to include them. The PATCH command overwrites the existing
flags with the ones specified in the request.
REST v1beta4
To set a flag for an existing database:
Before using any of the request data,
make the following replacements:
If there are existing flags configured for the database, modify the previous
command to include them. The PATCH command overwrites the existing
flags with the ones specified in the request.
Clear all flags to their default values
Console
In the Google Cloud console,
select the project that contains the Cloud SQL instance for which you want to clear all flags.
Open the instance and click Edit.
Open the Database flags section.
Click the X next to all of the flags shown.
Click Save to save your changes.
gcloud
Clear all flags to their default values on an instance:
To view all current values of the MySQL system variables, log into
your instance with the mysql client and enter the following statement:
SHOWVARIABLES;
Note that you can change the value only for supported flags (as listed below).
Determine which database flags have been set for an instance
To see which flags have been set for a Cloud SQL instance:
Console
In the Google Cloud console,
select the project that contains the Cloud SQL instance for which you want to see the database flags that have been set.
Select the instance to open its Instance Overview page.
The database flags that have been set are listed under the
Database flags section.
gcloud
Get the instance state:
gcloudsqlinstancesdescribeINSTANCE_NAME
In the output, database flags are listed under the settings as
the collection databaseFlags. For more information
about the representation of the flags in the output, see
Instances Resource Representation.
REST v1
To list flags configured for an instance:
Before using any of the request data,
make the following replacements:
project-id: The project ID
instance-id: The instance ID
HTTP method and URL:
GET https://sqladmin.googleapis.com/v1/projects/project-id/instances/instance-id
To send your request, expand one of these options:
For information about how to use this flag and its acceptable values,
see Configure parallel replication. This flag is not supported in MySQL 8.4 and later.
string There are two ways to specify timezones: as
timezone offsets and timezone names. For example, +00:00 is
the timezone offset for London (which is in the UTC timezone), and
Europe/London is its timezone name.
You use values to specify timezone offsets, from -12:59
to +13:00. Leading zeros are required.
When using timezone names, automatic adjustment to daylight saving
time is supported. When using timezone offsets, it isn't supported.
See a list of timezone names that
Cloud SQL for MySQL supports. You must update this flag
manually, on the primary instance and on all read replicas, to
account for it.
To set the timezone without causing a restart of the Cloud SQL
instance, use the set time_zone=timezone_offset
or timezone_name command with the
init_connect flag.
This flag value is dependent on innodb_buffer_pool_size
and innodb_buffer_pool_instances. MySQL can auto-tune the
value of innodb_buffer_pool_chunk_size based on these two
flags.
If you promote a replica with this flag enabled,
the flag is automatically removed causing the promoted replica to have
full durability by default. To use this flag with a promoted replica,
you can update the flag to the replica after promotion.
integer 1 ... 64
Supported in MySQL 5.7 and later.
For MySQL 5.7 and 8.0, the default is 4.
For MySQL 8.4, the default is equal to the value
of configured for the innodb_buffer_pool_instances flag.
If you use the default value of 0 for this flag,
table and database names are
case sensitive. When set to 1,
table and database names are case insensitive.
For MySQL 5.7 instances, you can change the value of this flag at any
time. If you do, then make sure that you understand how the change affects your
existing tables and databases.
For MySQL 8.0 and later instances, you can set the value of this flag
to a desired value only while an instance is being created. After you set this value,
you can't change it. Also, for an existing instance, you can't change the value of this flag.
When creating read replicas for MySQL 5.7, MySQL 8.0, or MySQL 8.4 instances,
the replica inherits this flag value from the primary.
boolean on | off default: off for MySQL 5.6, 5.7
default: off for MySQL 8.0 and later
instances with RAM less than 12 GB
default: on for MySQL 8.0 and later
instances with RAM greater than or equal to 12 GB
See Tips
section for more information about performance_schema flags.
See the Server SQL Modes
in the MySQL documentation for allowed values, including combined modes,
such as ANSI. NO_DIR_IN_CREATE is not
supported.
Cloud SQL for MySQL doesn't support empty values for the
sql_mode flag. Instead of using an empty value, set this
flag to the
NO_ENGINE_SUBSTITUTION
mode.
The default setting of 1 enables the synchronization of the binary
log to disk before transactions are committed.
If you promote a replica with this flag enabled,
the flag is automatically removed causing the promoted replica to have full durability
by default. To use this flag with a promoted replica, you can update the flag to
the replica after promotion.
See the Tips section for more information about this flag.
In this section, you'll learn about the time-zone names that Cloud SQL for MySQL supports.
The table in this section displays the following:
Timezone name: The name that Cloud SQL for MySQL supports.
STD: The time-zone offset in standard time (STD).
DST: The time-zone offset in daylight savings time (DST).
Synonym names: The names for time zones that you may want to use, but they aren't supported by Cloud SQL for MySQL. If this situation occurs, then use the corresponding time-zone name.
Timezone tables in Cloud SQL might need refreshing with the latest data. For example, a country might shift from a DST timezone offset to an STD offset or
a country might introduce a new timezone.
For every critical service agent (CSA) release for Cloud SQL, timezone tables are refreshed with the latest data. When this happens, during the non-maintenance window, the replica instances are refreshed. Primary instances are then refreshed during the maintenance window.
You can either wait until the regular maintenance window for the CSA release or you can perform self service maintenance to refresh the timezone tables with the latest data. For more information about viewing the available maintenance versions, see Determine the target maintenance version.
Tips for working with flags
general_log, slow_query_log
To make your general or slow query logs available,
enable the corresponding flag and set the log_output flag to
FILE.
This makes the log output available using the
Logs Viewer in the Google Cloud console.
Note that Google Cloud Observability logging charges apply.
To minimize instance storage cost,
general and slow query logs on the instance disk are
rotated when the log file is older than 24 hours (and no changes have been
made within that duration) or greater than 100MB in size. Old log files are
automatically deleted after the rotation.
If the log_output is set to NONE, you can't
access the logs. If you set log_output to TABLE, the
log output is placed in a table in the mysql system database. It might consume
a considerable amount of disk space. If this table becomes large, it can
affect instance restart time or cause the instance to lose its SLA coverage.
For this reason, the TABLE option is not recommended. In
addition, the log content isn't available in
Logs Explorer and it isn't rotated. If
needed, you can truncate your log tables by using the API. For more
information, see the
instances.truncateLog reference page.
expire_logs_days, binlog_expire_logs_seconds
If you enable point-in-time recovery, the expiration period of your binary
logs is determined by the lesser of your transaction log retention period
and the values of these flags. You can use these flags to manage how long
binary logs are stored on your replicas. The expire_logs_days
flag is removed from MySQL 8.4 and later. For more information,
see the
Transaction log retention.
innodb_buffer_pool_size
The value of this flag is the size in bytes of the buffer pool. The buffer pool size must always be equal to or a multiple of the value that you get when you multiply innodb_buffer_pool_chunk_size by innodb_buffer_pool_instances. If you alter the
buffer pool size to a value that's not equal to or a multiple of
innodb_buffer_pool_chunk_size multiplied by innodb_buffer_pool_instances, then Cloud SQL adjusts the buffer pool size automatically. You can't enable this flag on instances that have fewer than
3,840 MiB of RAM.
You can't configure this flag for shared-core machine types (f1_micro and
g1_small). Changing this flag on MySQL 5.6 requires a restart.
In Cloud SQL, the default, minimum allowable, and maximum allowable
values of the innodb_buffer_pool_size flag depend on the instance's memory.
These values can be roughly calculated as a percentage of the instance's RAM.
By default, the value of this flag is typically set close to the maximum
allowable value. The maximum allowable allocation percentage increases with
instance size. The minimum allowable value is usually about 20% of the
instance's RAM.
Approximate values for this flag:
Instance RAM Range
Min %
Default %
Max %
0 - 4.0GB of RAM
~34%
4.0GB - 7.5GB
~20%
~34%
~34%
7.5GB - 12GB
~20%
~52%
~52%
12GB - 24GB
~20%
~67%
~67%
24GB or more
~20%
~72%
~72%
Your exact values may vary. When managed buffer pool
is enabled, it makes adjustments to the innodb_buffer_pool_size that are not
reflected in Google Cloud console. To calculate the current value for your
instance, you can run the query:
showglobalvariableslike'innodb_buffer_pool_size';
For reference, the minimum allowable, default, and maximum allowable values
are provided for the following machine types.
Machine type
Instance RAM (GB)
Min (GB) (% of total)
Default (GB) (% of total)
Max (GB) (% of total)
db-f1-micro
0.6
-
0.053
-
db-g1-small
1.7
-
0.625
-
db-custom-1-3840
3.75
0.875 (23%)
1.375 (37%)
1.375 (37%)
db-custom-2-7680
7.5
1.5 (20%)
4 (53%)
4 (53%)
db-custom-4-15360
15
3 (20%)
10.5 (70%)
10.5 (70%)
db-custom-8-30720
30
6 (20%)
22 (73%)
22 (73%)
db-custom-16-61440
60
12 (20%)
44 (73%)
44 (73%)
db-custom-32-122880
120
24 (20%)
87 (73%)
87 (73%)
db-custom-64-245760
240
48 (20%)
173 (72%)
173 (72%)
db-custom-96-368640
360
72 (20%)
260 (72%)
260 (72%)
db-custom-2-13312
13
3 (23%)
9 (69%)
9 (69%)
db-custom-4-26624
26
6 (23%)
19 (73%)
19 (73%)
db-custom-8-53248
52
11 (21%)
38 (73%)
38 (73%)
db-custom-16-106496
104
21 (20%)
75 (72%)
75 (72%)
db-custom-32-212992
208
42 (20%)
150 (72%)
150 (72%)
db-custom-64-425984
416
84 (20%)
300 (72%)
300 (72%)
db-custom-96-638976
624
125 (20%)
450 (72%)
450 (72%)
If the memory usage is high for your instance and you're
experiencing out-of-memory (OOM) events, then you can enable the
innodb_cloudsql_managed_buffer_pool flag to reduce the value
of your innodb_buffer_pool_size temporarily.
For more information, see
Enable managed buffer pool.
When managed buffer pool makes adjustments to value of innodb_buffer_pool_size, the
changes aren't reflected in the flag value displayed in Google Cloud console. In order to view the
current value of innodb_buffer_pool_size when managed buffer pool is enabled, you
can query the flag value by using the MySQL client:
showglobalvariableslike'innodb_buffer_pool_size';
innodb_cloudsql_optimized_write
This flag is available only for Cloud SQL Enterprise Plus edition instances. The default value
is `ON`.
This flag improves write performance by optimizing the flushing algorithm,
controlling flush limits, and adjusting background activity to prioritize
your database write operations. In addition, this flag enables an improved crash
recovery algorithm to reduce crash recovery time and
utilizes unused disk I/O throughput adaptively to accelerate buffer pool warm-up.
For the majority of use cases,
you can experience better performance such as improved throughput and reduced
latency with this flag enabled.
However, if your database write operations cause extremely heavy load
on the server, then the flag can delay some background activities.
This delay can cause a small increase in disk usage, which decreases automatically after the load subsides.
By default, the innodb_cloudsql_optimized_write flag is
enabled for all new and upgraded Cloud SQL Enterprise Plus edition instances. For existing Cloud SQL Enterprise Plus edition instances, this flag is enabled after the related maintenance update is applied.
If you need to disable the flag, then run the following command.
Changing the value of the flag requires restarting the instance.
innodb_file_per_table
For all MySQL versions 5.6 and higher, the default value is ON.
innodb_flush_log_at_trx_commit, sync_binlog
For full ACID compliance, and to maintain durability and consistency in
a replication setup, the innodb_flush_log_at_trx_commit and
the sync_binlog flags must be set to the default value of
1. If you change the default value, then durability might
decrease, which might lead to inconsistency between the primary instance
and replicas. Therefore, the instance loses its SLA coverage. In addition,
any of the following might occur:
Data loss in certain situations, such as a VM crash or failover for regional HA instance
Out-of-sync data in binary log and InnoDB data files
PITR data loss or failure
Data inconsistency between a primary instance and its replicas
A replication break
Setting the value of the
innodb_flush_log_at_trx_commit or sync_binlog
flag to non-default values for primary, standalone, and HA instances causes
reduced durability.
If you need higher performance for read replicas, then we recommend setting
the innodb_flush_log_at_trx_commit value to 2. If
you do so, you must either disable the binary log on the replica, or set
sync_binlog to a
value other than 1 for higher performance.
For highest performance and lowest durability, you can also set the
innodb_flush_log_at_trx_commit flag to 0
on read replicas, but make this configuration change with caution.
Use the gcloud CLI or the Cloud SQL Admin API to set the
innodb_flush_log_at_trx_commit flag to 0.
You can apply this configuration only to read replicas, not to primary
or standalone instances. The 0 value for this flag isn't
available in the Google Cloud console. The gcloud CLI command to use for
this takes the following form, in which all current flag values must
be included:
Cloud SQL might temporarily change the innodb_flush_log_at_trx_commit
and sync_binlog flag values to default when taking a backup. This might
cause reduced performance when taking backups. To avoid this from impacting
your instance, you can change
the backup window when instance usage is low. For more information,
see Create and manage on-demand and
automatic backups.
innodb_flush_log_at_timeout
innodb_flush_log_at_timeout lets you modify the frequency
of page flushes so you can avoid impacting the performance of binary log group
commit. The default setting is once per second.
Cloud SQL has extended this flag to support specifying a time period
in microseconds.
Examples:
0.001 to specify 1 ms
0.0001 to specify 100 us
12.5 to specify 12.5 seconds
12.005 to specify 12 seconds and 5 ms
0.005100 to specify 5 ms and 100 us
For certain workloads, using whole second granularity for
flushing pages might be unacceptable in terms of
potential transaction loss. Instead, you can flush pages using microsecond
granularity to maintain performance without significantly
compromising durability.
The microsecond time periods for the innodb_flush_log_at_timeout
flag are only applicable when the innodb_flush_log_at_trx_commit
durability flag is set to 2.
The flushing of pages might happen more or less frequently than the value
specified for innodb_flush_log_at_timeout and the value is not the
upper bound.
innodb_redo_log_capacity, innodb_log_file_size
For Cloud SQL for MySQL version 8.4 and earlier,
if you configure a value for the innodb_redo_log_capacity flag,
then Cloud SQL ignores any value that you define for
the innodb_log_file_size flag.
If you don't configure any values for
the innodb_redo_log_capacity or innodb_log_file_size
flags, then Cloud SQL uses
the default value of the innodb_redo_log_capacity flag, or 104857600 (100 MB).
If you don't configure the innodb_redo_log_capacity flag, but configure
the innodb_log_file_size flag,
then the value of your innodb redo log size is calculated by innodb_log_file_size * innodb_log_file_in_group. For example, if you configure
innodb_log_file_size to a value of 10 GB and the default value of
innodb_log_file_in_group is 2, then the effective
value of your innodb redo log size is 20 GB.
In Cloud SQL for MySQL version 9.7 and later, the innodb_log_file_size
and innodb_log_file_in_group flags are removed from Cloud SQL.
The default values for the innodb_redo_log_capacity flag are based
on the edition and RAM capacity of the instance and as listed in the following table.
Cloud SQL edition
RAM
Default value
Cloud SQL Enterprise edition
Any size
1 GB
Cloud SQL Enterprise Plus edition
<100 GB
1 GB
Cloud SQL Enterprise Plus edition
>100 GB
1.5 GB
max_heap_table_size, tmp_table_size
Exhausting the available instance memory can occur when you set
tmp_table_size and max_heap_table_size too high for
the number of concurrent queries the instance processes. Exhausting the memory
results in an instance crash and restart.
You can't enable this flag on instances with a shared core (less than 3 GB of RAM).
If you enable this flag, then you can't change your machine type to a size
that does not support the flag; you must first disable this flag.
For MySQL 8.0 and later instances with 12 GB to 15 GB RAM,
the default value of the performance_schema is on;
however, the default performance schema instruments are
disabled. For more information about default performance
schema instruments, see
The setup_instruments Table (MySQL 8.0) or
The setup_instruments Table (MySQL 8.4). If you want to enable and use
performance schema instruments in a 12 GB to 15 GB
RAM instance, then you must explicitly set the performance_schema
flag to on instead of deferring to the default value.
For MySQL 8.0 and later instances with ≥15 GB RAM,
the default value of the performance_schema is on
the default performance schema instruments are enabled.
event_scheduler
MySQL Events, also known as scheduled events, are tasks that you can schedule.
Scheduled events are a group of one or more SQL statements that are set to
execute at one or more specified intervals. The default value for MySQL 5.7 is
OFF and the default value for MySQL 8.0 is ON. To
learn more about the event_scheduler flag, see
event_scheduler.
If the event_scheduler flag is set to ON for a read
replica, it can cause errors based on the type of statements defined in the
events:
If your scheduled event is a write event on a read
replica, it causes an error as read replicas are read-only. See
Read Replicas for
more information.
If your scheduled event contains a stop operation, such as
kill, event_scheduler applies it to the replica.
This stops the replication and delete the replica.
To avoid such errors, set the event_scheduler flag to OFF
when creating replicas.
For more information on how to enable or disable event_scheduler,
see Configure database flags.
replica_skip_errors,slave_skip_errors
Setting the replica_skip_errors or the slave_skip_errors
flag can cause replication issues. In general,
if an error occurs while executing a statement, the replication is stopped.
Using this flag will cause the error to be skipped and replication to continue,
leading to inconsistency between the primary instance and replica.
This can also make it harder to troubleshoot replication issues.
Cloud SQL recommends only using this flag if necessary. If you
are experiencing replication errors, see the
Troubleshooting Cloud SQL: Replication
page for more information on how to resolve
this issue.
These flags can't be selected directly in the Google Cloud console or using gcloud CLI.
To use these flags, use the following command:
SETGLOBALFLAG_NAME=FLAG_VALUE
Using the SET GLOBAL command requires the CLOUDSQL_SPECIAL_SYSEM_VARIABLES_ADMIN
privilege, which is granted to the cloudsqlsuperuser role.
Note: The CLOUDSQL_SPECIAL_SYSEM_VARIABLES_ADMIN privilege
is only available in MySQL 8.0 for Cloud SQL.
For more information on how to grant special privilege access to a specific user, see
About MySQL users.
These flags are non-persisted. When your Cloud SQL instance is recreated or
restarted, the flag settings are reset back to default value.
caching_sha2_password_proxy_users
Use the caching_sha2_password_proxy_users flag for proxy user connectivity in MySQL 9.7. Because the mysql_native_password authentication method is no longer available in MySQL 9.7, you can't use the mysql_native_password_proxy_users flag.
The caching_sha2_password_proxy_users flag controls whether the caching_sha2_password built-in authentication plugin supports
proxy users. The flag has no effect unless
the check_proxy_users system variable is enabled.
binlog_order_commits
The default value for the binlog_order_commits flag is
ON. Cloud SQL recommends to not change the default
value of this flag. If the default value is changed to
OFF, transactions in the same binary log group will
commit in a different order than when they were written in the binary
log. This impacts the following operations that execute transactions
in the binary log order:
Replication: may lead to data inconsistency
between the source and replicas
Point-in-time-recovery: may lead to data
inconsistency between the PITR restored state and historical state
Optimizer flags have comma-separated values. You can set these flags using
the Google Cloud console or the gcloud CLI. For more information on how to
set this flag using the console, see
Configure database
flags. If using the gcloud CLI, then you can specify the value for
these flags using two different ways:
To set multiple optimizer sub-flags in one command, use the comma delimiter to
separate each flag name. If you set a single sub-flag value using the
gcloud CLI command, then it overwrites all previously set sub-flags.
For example, if you run the following command, the expected value for
the batched_key_access sub-flag is set to on and all
other sub-flags for optimizer_flags are set to their default values.
If you run the following command, the value of the
block_nested_loop sub-flag is set to on and all
other sub-flags for optimizer_switch are overwritten and set to their default
values.
This includes batched_key_access, which was set to on
by the previous command. To keep all previously set sub-flags and add new
ones, you must add the values of all sub-flags you want to set when adding a
new sub-flag.
All other database system flags that aren't listed in the
supported flags section are called managed flags. For
certain managed flags, Cloud SQL sets the flag to a value other than the
default setting to ensure Cloud SQL instances run reliably. You can't change
the values on these system flags.
The following list shows managed flags with a non-default setting:
partial_revokes system flag in MySQL 8.0 and later
The partial_revokes flag lets you limit user access on a database schema.
In Cloud SQL for MySQL version 8.0 and later, the partial_revokes flag is set to
ON. This limits the use of wildcard characters when granting or
revoking user privileges to database schemas in MySQL 8.0. Update your
GRANT statement to use the full name of the database schema
instead of using wildcard characters.
For example, if you use the following command with the %\ wildcard character
to grant privileges to a user in MySQL 5.7, then the user will be granted
privileges to all databases ending with _foobar.
With partial_revokes, you can use the grant and
revoke command to grant user privileges on all database schemas while
restricting access to a few database schemas.
This grants access to all database schemas while restricting access to
test3_foobar.*.
Replication filters
Replication filters can be set only on Cloud SQL replicas. Each replication
filter is set as a single flag for multiple databases where each database name
is separate by a comma. You can set up a replication filter on a Cloud SQL replica using
console or the following command:
Replication filters don't support database names that contain comma values. The
^~^ value in the preceding command is necessary for database flags that are
comma-separated values.
When you set a replication filter flag, keep the following in mind:
If the replica becomes unhealthy, then data filtered by replication filters
can appear on the replica as Cloud SQL uses source data from the primary to
rebuild the instance replica.
You can't set replication filters on the mysql schema.
Replication filter rules don't apply to serverless exports.
Index advisor flags
The following is a list of database flags that Cloud SQL for MySQL uses
to enable and manage features specific to the
index advisor.
Flag name
Type Acceptable values and notes
Restart Required?
cloudsql_index_advisor_auto_advisor_schedule
string default: 00:00
No
cloudsql_index_advisor_run_at_timestamp
Datetime default: 00:00:00
No
Aliased flags
The following list contains the flag names that have been changed by
Cloud SQL for MySQL versions 8.0.26 and later.
Deprecated flag name
New flag name
log_slow_slave_statements
log_slow_replica_statements
master_verify_checksum
source_verify_checksum
slave_checkpoint_group
replica_checkpoint_group
slave_checkpoint_period
replica_checkpoint_period
slave_compressed_protocol
replica_compressed_protocol
slave_net_timeout
replica_net_timeout
slave_parallel_type
replica_parallel_type
slave_parallel_workers
replica_parallel_workers
slave_pending_jobs_size_max
replica_pending_jobs_size_max
slave_preserve_commit_order
replica_preserve_commit_order
slave_skip_errors
replica_skip_errors
slave_sql_verify_checksum
replica_sql_verify_checksum
slave_transaction_retries
replica_transaction_retries
slave_type_conversions
replica_type_conversions
sync_master_info
sync_source_info
If your Cloud SQL instance is using a deprecated flag name, then
edit your Cloud SQL instance, delete the deprecated flag name, and add the
new flag to your instance. For more information, see
Setup a database flag.
Troubleshooting
Issue
Troubleshooting
After enabling a flag the instance loops between panicking and crashing.
Contact customer support to
request flag removal followed by a hard drain. This forces the
instance to restart on a different host with a fresh configuration without
the undesired flag or setting.
You see the error message Bad syntax for dict arg when
trying to set a flag.
Complex parameter values, such as comma-separated lists, require special
treatment when used with gcloud commands.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-09-30 UTC."],[],[]]