If you are not sure if the website you would like to visit is secure, you can verify it here. Enter the website address of the page and see parts of its content and the thumbnail images on this site. None (if any) dangerous scripts on the referenced page will be executed. Additionally, if the selected site contains subpages, you can verify it (review) in batches containing 5 pages.
favicon.ico: docs.cloud.google.com/sql/docs/mysql/executesql-instance - Execute SQL statements using t.

site address: docs.cloud.google.com/sql/docs/mysql/executesql-instance redirected to: docs.cloud.google.com/sql/docs/mysql/executesql-instance

site title: Execute SQL statements using the Cloud SQL Data API     Cloud SQL for MySQL     Google Cloud Documentation

Our opinion (on Wednesday 22 July 2026 4:12:06 UTC):

GREEN status (no comments) - no comments
After content analysis of this website we propose the following hashtags:



Meta tags:
description=Learn how to execute SQL statements on instances using gcloud and the REST API.;

Headings (most frequently used words):

the, sql, changes, execute, cloud, data, api, and, or, prepare, apply, gcloud, statements, using, stay, organized, with, collections, save, categorize, content, based, on, your, preferences, before, you, begin, enable, disable, statement, shell, directory, limitations, configure, database, user, required, roles, permissions, console, terraform, rest, modify, truncation, behavior, products, pricing, support, resources, engage, delete,

Text of the page (most frequently used words):
the (182), sql (98), cloud (85), and (80), instance (59), #database (51), data (45), for (42), using (41), connect (40), use (39), with (36), instances (33), api (33), from (28), can (27), you (27), manage (26), create (26), user (25), your (21), terraform (21), google (19), execute (19), iam (19), access (19), overview (19), statements (17), mysql (17), name (17), this (16), about (15), set (15), account (15), roles (15), configure (15), upgrade (14), secret (14), are (13), script (13), service (13), apply (12), private (12), that (11), statement (11), result (11), following (11), databases (11), gcloud (11), resources (10), import (10), quickstart (10), high (9), external (9), server (9), project (9), custom (9), engine (9), code (8), run (8), instance_name (8), resource (8), directory (8), file (8), authentication (8), password (8), availability (8), thumb (7), policies (7), error (7), performance (7), then (7), replication (7), configuration (7), version (7), export (7), enable (7), disable (7), language (7), management (7), vector (7), managed (7), read (7), samples (6), control (6), when (6), memory (6), issues (6), best (6), only (6), tables (6), make (6), view (6), console (6), settings (6), users (6), authenticate (6), storage (6), backups (6), monitor (6), recovery (6), replicas (6), see (5), requests (5), not (5), supported (5), maintenance (5), running (5), practices (5), usage (5), each (5), queries (5), executesql (5), how (5), partial_result_mode (5), sql_statement (5), database_name (5), endpoint (5), created (5), changes (5), open (5), main (5), must (5), shell (5), place (5), regional (5), built (5), cloudsql (5), public (5), query (5), tools (5), connection (5), certificates (5), ssl (5), tls (5), encryption (5), embeddings (5), choose (5), app (5), proxy (5), support (4), other (4), down (4), information (4), sample (4), need (4), more (4), page (4), its (4), projects (4), large (4), files (4), like (4), table (4), allow_partial_result (4), same (4), fail_partial_result (4), partial (4), default (4), request (4), project_id (4), against (4), delete (4), them (4), add (4), google_sql_provision_script (4), command (4), environment (4), new (4), have (4), reference (4), cloudsqlsuperuser (4), assign (4), privileges (4), manager (4), region (4), migration (4), compute (4), application (4), reconfigure (4), optimize (4), logs (4), build (4), disaster (4), auth (4), organization (4), major (4), free (4), terms (3), system (3), understand (3), last (3), updated (3), otherwise (3), content (3), send (3), execution (3), response (3), locations (3), client (3), certain (3), out (3), number (3), concurrent (3), per (3), back (3), results (3), partialresultmode (3), mode (3), partial_result_mode_unspecified (3), exceeds (3), field (3), truncation (3), behavior (3), optional (3), controls (3), within (3), replacements (3), should (3), rest (3), such (3), exists (3), required (3), option (3), save (3), copy (3), end (3), example (3), also (3), prepare (3), any (3), google_sql_database_instance (3), select (3), role (3), privilege (3), grant (3), allow_data_api (3), stored (3), secrets (3), flag (3), cli (3), patch (3), click (3), networking (3), time (3), permission (3), studio (3), admin (3), security (3), services (3), updates (3), guides (3), observability (3), analytics (3), capacity (3), troubleshoot (3), reduce (3), prevent (3), backup (3), auditing (3), indexes (3), insights (3), mcp (3), capture (3), audit (3), search (3), model (3), applications (3), restore (3), standard (3), migrate (3), vpc (3), pooling (3), connectors (3), customer (3), tags (3), secure (3), trial (3), product (3), 한국어 (2), 日本語 (2), עברית (2), português (2), brasil (2), italiano (2), indonesia (2), français (2), español (2), américa (2), latina (2), deutsch (2), english (2), sign (2), join (2), site (2), youtube (2), events (2), architecture (2), started (2), github (2), status (2), pricing (2), all (2), products (2), 2026 (2), utc (2), licensed (2), under (2), license (2), feedback (2), location (2), will (2), fail (2), assured (2), workloads (2), manually (2), operations (2), later (2), cause (2), errors (2), even (2), warnings (2), contain (2), maximum (2), messages (2), limit (2), reached (2), may (2), again (2), ddl (2), doesn (2), size (2), truncated (2), return (2), true (2), retrieved (2), don (2), throw (2), including (2), values (2), modify (2), modifying (2), com (2), post (2), explicitly (2), enabled (2), note (2), has (2), complete (2), review (2), update (2), plan (2), once (2), init (2), optionally (2), include (2), recommended (2), tutorial (2), root (2), module (2), where (2), steps (2), google_sql_user (2), iam_user (2), identity (2), used (2), config (2), lesser (2), least (2), cloud_iam_user (2), type (2), versions (2), password_secret_version (2), disallow_data_api (2), allow (2), connections (2), define (2), permissions (2), conditions (2), predefined (2), updating (2), creating (2), group (2), before (2), small (2), documentation (2), sdk (2), languages (2), frameworks (2), infrastructure (2), costs (2), monitoring (2), industry (2), solutions (2), distributed (2), hybrid (2), multicloud (2), pipelines (2), hosting (2), development (2), known (2), remove (2), authorized (2), networks (2), log (2), loss (2), enabling (2), automated (2), cache (2), improve (2), enterprise (2), plus (2), assistance (2), agents (2), saved (2), generate (2), invoke (2), predictions (2), dump (2), perform (2), point (2), replicate (2), pool (2), pools (2), kubernetes (2), flexible (2), phpmyadmin (2), authorize (2), write (2), keys (2), cmek (2), parameterized (2), views (2), minor (2), network (2), edition (2), shrink (2), start (2), cross (2), technology (2), areas (2), close (2), subscribe, newsletter, our, third, decade, climate, action, cookies, privacy, tech, twitter, blog, engage, training, certification, center, getting, release, notes, community, forums, contact, sales, marketplace, easy, easytounderstand, solved, problem, solvedmyproblem, otherup, hard, hardtounderstand, incorrect, incorrectinformationorsamplecode, missing, missingtheinformationsamplesineed, otherdown, tell, except, noted, details, java, registered, trademark, oracle, affiliates, developers, apache, creative, commons, attribution, might, transit, through, intermediate, between, target, reason, packages, folders, enforced, constraints, restrictnoncompliantresourcecreation, temporarily, blocked, integrity, purposes, ongoing, retry, happens, consume, amount, avoiding, these, utilization, often, causes, stalls, downtime, managing, notices, available, multi, there, syntax, returned, limits, subsequent, most, try, reads, taking, longer, than, seconds, canceled, setting, higher, timeout, isn, long, timing, orphaned, safely, rolled, cautious, alter, session, max_execution_time, limited, exceeding, thrown, limitations, unspecified, effectively, due, partial_result, handled, executing, accepts, responds, autoiamauthn, sqlstatement, body, sqladmin, googleapis, v1beta4, deleting, won, drop, typically, assume, apis, navigate, sure, entering, prompt, wait, until, displays, message, yes, verify, going, match, expectations, corrections, necessary, initialize, latest, provider, parameters, snippet, part, solution, into, newly, section, step, filename, extension, referred, mkdir, touch, own, called, variables, overridden, explicit, google_cloud_project, want, configurations, launch, sections, depends_on, via, connects, exist, dbs, description, google_sql_database, some, require, pets, idempotent, patterns, modified, whole, executed, inline, path, database_roles, first, granted, follow, principle, cloud_iam_service_account, huamn, value, cloudsql_iam_authentication, database_flags, allows, data_api_access, perf, optimized, tier, mysql_8_4, database_version, provision, extensions, grants, without, connecting, holding, expected, format, secret_version, omit, hostname, needed, respond, incomplete, contains, spaces, special, characters, quoted, either, replace, which, checkbox, tab, navigation, menu, includes, studiouser, instanceuser, accounts, one, practice, specific, but, store, asks, instead, global, while, needs, take, begin, addresses, supports, types, manipulation, dml, definition, dql, good, quick, administrative, making, schema, describes, postgresql, categorize, based, preferences, stay, organized, collections, home, orphan, diagnose, debug, looker, rotate, broad, ranges, underprovisioned, overprovisioned, idle, temporary, increasing, retention, cpu, disk, definitions, increase, reliability, enforce, recommendations, active, index, advisor, natural, querydata, conversational, securing, agent, interactions, remote, work, preview, filter, register, interact, models, llm, powered, langchain, embedding, workflow, online, integrate, vertex, generative, develop, check, cancel, parallel, csv, importing, exporting, deleted, enhanced, advanced, legacy, percona, xtrabackup, physical, replicating, autoscaling, lag, promote, outside, functions, operator, dns, certificate, authority, across, multiple, vpcs, both, learn, brute, force, protection, endpoints, side, attach, fine, grained, handle, residency, knowledge, catalog, gemini, character, collation, operational, guidelines, general, migrating, troubleshooting, peering, allowlists, self, windows, connectivity, tests, flags, deletion, label, stop, restart, clone, edit, machine, series, local, computer, get, key, features, editions, discover, skip,


Text of the page (random words):
insights monitor cloud sql using the database insights mcp server apply recommendations create indexes or reconfigure join settings disable public ip enable database auditing enforce ssl tls encryption improve instance reliability by enabling high availability improve performance with enterprise plus increase the table open cache manage open tables and open table definitions manage high number of tables monitor disk availability optimize high cpu usage optimize high memory usage optimize instances with high number of out of memory events prevent data loss by enabling automated backups prevent data loss by increasing backup retention reconfigure connection settings reconfigure log settings reconfigure temporary table settings reduce idle cloud sql instances reduce overprovisioned cloud sql instances reduce underprovisioned cloud sql instances remove authorized networks remove broad public ip ranges rotate server certificates set instance password policies set user password policies use looker with cloud sql troubleshoot known issues troubleshoot error messages debug connection issues diagnose issues orphan tables issues updating storage capacity ai and ml application development application hosting compute data analytics and pipelines databases distributed hybrid and multicloud industry solutions migration networking observability and monitoring security storage access and resources management costs and usage management infrastructure as code sdk languages frameworks and tools home documentation databases cloud sql mysql guides send feedback execute sql statements using the cloud sql data api stay organized with collections save and categorize content based on your preferences mysql postgresql sql server this page describes how to execute sql statements against databases on cloud sql instances using the data api with the data api you use the cloud sql admin api and gcloud cli to run sql statements on any instance where you ve enabled data api access you can use the data api with instances that use public ip addresses private services access or private service connect the data api supports all types of sql statements including data manipulation language dml data definition language ddl and data query language dql the data api is good for running small and quick administrative statements such as creating database roles or users and making small schema updates before you begin before you can execute sql statements on an instance take the following steps configure the database user the data api needs to authenticate as a database user to execute sql statements you can authenticate as a built in user iam user iam service account or iam group to authenticate using iam do the following configure the instance for iam database authentication add an iam user service account or group to the instance grant the account the required roles or privileges to execute sql statements you can assign database roles while creating the account or updating the account if you have created custom database roles with least privileges assign them to the account otherwise assign the predefined cloudsqlsuperuser role to the account use the data api to create new custom database roles with lesser privileges and then grant the new roles to the account in place of cloudsqlsuperuser to authenticate as a built in user using password do the following create a user note the data api can t authenticate as the default root user use secret manager to create a regional secret to store the password for security the data api asks for the secret s resource name instead of the password in the api request the regional secret should be stored in the same region as your cloud sql instance a secret created using secret manager s global endpoint are not supported even if it s stored in the same region as a best practice define optional iam conditions to allow a user to access a specific secret but not other secrets in the project required roles or permissions by default user or service accounts with one of the following roles have the permission to execute sql statements on a cloud sql instance cloudsql instances executesql cloud sql admin roles cloudsql admin cloud sql instance user roles cloudsql instanceuser cloud sql studio user roles cloudsql studiouser you can also define an iam custom role for the user or service account that includes the cloudsql instances executesql permission this permission is supported in iam custom roles enable or disable the data api to use the data api you must enable it for each instance you can disable the data api at any time console in the google cloud console go to the cloud sql instances page go to cloud sql instances to open the overview page of an instance click the instance name from the sql navigation menu select connections click the networking tab select the allow data api checkbox click save gcloud to enable data api access on an instance use the gcloud sql instances patch command with the data api access allow_data_api flag gcloud sql instances patch instance_name data api access allow_data_api to disable data api access use the data api access disallow_data_api flag gcloud sql instances patch instance_name data api access disallow_data_api replace instance_name with the name of the instance on which to enable or disable the data api execute a sql statement you can execute sql statements against databases on your cloud sql instance using either gcloud cli or the rest api gcloud to execute a sql statement against a database on an instance using the gcloud cli use the gcloud sql instances execute sql command to connect using iam gcloud sql instances execute sql instance_name database database_name sql sql_statement partial result mode partial_result_mode make the following replacements instance_name the name of the instance database_name the name of the database within the instance sql_statement the sql statement to execute if the statement contains spaces or shell special characters then it must be quoted partial_result_mode optional controls how to respond when result is incomplete can be allow_partial_result fail_partial_result or partial_result_mode_unspecified see modifying truncation behavior you can also include the project project_id flag if needed to connect as a built in user using password gcloud sql instances execute sql instance_name database database_name sql sql_statement user user password secret version password_secret_version partial result mode partial_result_mode make the following replacements user the database user to authenticate as omit the and hostname password_secret_version the resource name of the secret manager secret holding the password for the database user the secret should be a regional secret and stored in the same region as the cloud sql instance the expected resource name format is projects project locations location secrets secret versions secret_version terraform you can use data api on terraform to provision in database resources such as databases tables extensions users and privilege grants without manually connecting to the instance to execute a sql script on terraform use the google_sql_provision_script terraform resource resource google_sql_database_instance instance name my instance database_version mysql_8_4 settings tier db perf optimized n 2 data_api_access allow_data_api this allows the use of data api database_flags name cloudsql_iam_authentication value on create a database user for your account and grant roles so it has privilege to access the database set the type to cloud_iam_user for huamn account or cloud_iam_service_account for service account resource google_sql_user iam_user name account used to apply this config example com instance google_sql_database_instance instance name type cloud_iam_user roles granted to the user to follow the principle of least privilege you can first use google_sql_provision_script to create custom database role s with lesser privileges and then assign them to this user in place of cloudsqlsuperuser this field doesn t support mysql 5 6 and 5 7 database_roles cloudsqlsuperuser resource google_sql_provision_script script you can inline the script or import from a file like script file path module script sql when modified the whole script will be executed again it s recommended to make the script idempotent with patterns like create if not exists or if not exists select then end if script create database pets instance google_sql_database_instance instance name some of your queries may require a database you can create and use a database in the script or explicitly create and reference a database like database google_sql_database database name description sql script to create dbs the identity account used to apply your terraform config must exist as an iam user or iam service account in the instance terraform connects to the instance via iam database authentication to execute the script depends_on google_sql_user iam_user apply the changes to apply your terraform configuration in a google cloud project complete the steps in the following sections prepare cloud shell launch cloud shell 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 note terraform samples typically assume that the required apis are enabled in your google cloud project delete the changes deleting a google_sql_provision_script resource won t delete the in database resources it created to delete them you can explicitly add statements in the script such as drop if exists and then apply the changes rest to execute a sql statement against a database on an instance using the rest api send a post request to the executesql endpoint post h tt ps sqladmin googleapis com sql v1beta4 projects project_id instances instance_name executesql the request body should contain the database name and the sql statement database database_name sqlstatement sql_statement partialresultmode partial_result_mode autoiamauthn true make the following replacements project_id your project id instance_name the name of the instance database_name the name of the database within the instance sql_statement the sql statement to execute partial_result_mode optional controls how the api responds when the result exceeds 10 mb can be fail_partial_result allow_partial_result or partial_result_mode_unspecified see modifying truncation behavior modify truncation behavior you can control how large results are handled when executing sql by including the partialresultmode field in the request this field accepts the following values fail_partial_result default throw an error if the result exceeds 10 mb or if only a partial result can be retrieved don t return the result allow_partial_result return a truncated result and set partial_result to true if the result exceeds 10 mb or if only a partial result can be retrieved due to error don t throw an error partial_result_mode_unspecified unspecified mode effectively the same as fail_partial_result limitations the size limit for a response is 10 mb results exceeding this size are truncated if partialresultmode is set to allow_partial_result otherwise an error is thrown requests are limited to 0 5 mb you can only run sql statements for cloud sql for mysql instances that are running cloud sql doesn t support using the data api with instances that are set up for external server replication requests taking longer than 30 seconds are canceled setting a higher statement timeout using set session max_execution_time isn t supported for cloud sql for mysql 5 6 and 5 7 long running ddl statements timing out can cause orphaned files or tables that can t be safely rolled back be cautious with statements like alter table on large tables cloud sql limits the number of concurrent executesql requests to 10 per instance for each user if this limit is reached subsequent requests fail with at most 10 concurrent queries may be run on this instance try again later or maximum concurrent reads 10 reached each response can contain a maximum of 10 database messages or warnings if there is a statement syntax or execution error then no result is returned for cloud sql for mysql notices and warnings are available only for the last statement of a multi statement execution statements that consume a large amount of memory can cause out of memory errors for more information on avoiding these errors see best practices for managing memory usage a database instance running with high memory utilization often causes performance issues stalls or even database downtime data api can be temporarily blocked for data integrity purposes when certain maintenance operations are ongoing on the instance retry later if it happens the sql script and its execution response might transit through intermediate locations between your client and the location of the target instance for this reason requests will fail with the error not supported for instances in certain assured workloads control packages folders for certain assured workloads projects and for projects with constraints sql restrictnoncompliantresourcecreation manually enforced send feedback except as otherwise noted the content of this page is licensed under the creative commons attribution 4 0 license and code samples are licensed under the apache 2 0 license for details see the google developers site policies java is a reg...
Thumbnail images (randomly selected): * Images may be subject to copyright.GREEN status (no comments)
  • Google Cloud Documentatio...

Verified site has: 263 subpage(s). Do you want to verify them? Verify pages:

1-5 6-10 11-15 16-20 21-25 26-30 31-35 36-40 41-45 46-50
51-55 56-60 61-65 66-70 71-75 76-80 81-85 86-90 91-95 96-100
101-105 106-110 111-115 116-120 121-125 126-130 131-135 136-140 141-145 146-150
151-155 156-160 161-165 166-170 171-175 176-180 181-185 186-190 191-195 196-200
201-205 206-210 211-215 216-220 221-225 226-230 231-235 236-240 241-245 246-250
251-255 256-260 261-263


Top 50 hastags from of all verified websites.

Supplementary Information (add-on for SEO geeks)*- See more on header.verify-www.com

Header

HTTP/1.1 301 Moved Permanently
location htt????/docs.cloud.google.com/sql/docs/mysql/executesql-instance
x-cloud-trace-context 1483e1c2516b51eb532167578fdafb2f
date Wed, 22 Jul 2026 04:12:04 GMT
content-type text/html
server Google Frontend
Content-Length 0
Connection close
HTTP/2 200
last-modified Mon, 20 Jul 2026 22:35:23 GMT
content-type text/html; charset=utf-8
vary Cookie
vary Accept-Encoding
content-security-policy base-uri self ; object-src none ; script-src strict-dynamic unsafe-inline https: http: nonce-bAux2cQGyOH2BmzVA6VVGV2ie+GDtB unsafe-eval ; frame-ancestors self htt????/developers.google.com/_d/analytics-iframe; report-uri htt????/csp.withgoogle.com/csp/devsite/v2
strict-transport-security max-age=63072000; includeSubdomains; preload
x-xss-protection 0
x-content-type-options nosniff
cache-control no-cache, must-revalidate
expires 0
pragma no-cache
content-encoding gzip
x-cloud-trace-context 788f1282c97ed5222be592d882c4c825
date Wed, 22 Jul 2026 04:12:06 GMT
server Google Frontend
content-length 33551
alt-svc h3= :443 ; ma=2592000,h3-29= :443 ; ma=2592000

Meta Tags

title="Execute SQL statements using the Cloud SQL Data API  |  Cloud SQL for MySQL  |  Google Cloud Documentation"
name="google-signin-client-id" content="721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com"
name="google-signin-scope" content="profile email htt????/www.googleapis.com/auth/developerprofiles htt????/www.googleapis.com/auth/developerprofiles.award htt????/www.googleapis.com/auth/devprofiles.full_control.firstparty"
property="og:site_name" content="Google Cloud Documentation"
property="og:type" content="website"
name="theme-color" content="#1a73e8"
charset="utf-8"
content="IE=Edge" http-equiv="X-UA-Compatible"
name="viewport" content="width=device-width, initial-scale=1"
property="og:title" content="Execute SQL statements using the Cloud SQL Data API  |  Cloud SQL for MySQL  |  Google Cloud Documentation"
name="description" content="Learn how to execute SQL statements on instances using gcloud and the REST API."
property="og:description" content="Learn how to execute SQL statements on instances using gcloud and the REST API."
property="og:url" content="htt????/docs.cloud.google.com/sql/docs/mysql/executesql-instance"
property="og:image" content="htt????/docs.cloud.google.com/_static/cloud/images/social-icon-google-cloud-1200-630.png"
property="og:image:width" content="1200"
property="og:image:height" content="630"
property="og:locale" content="en"
name="twitter:card" content="summary_large_image"

Load Info

page size33551
load time (s)1.703133
redirect count1
speed download19701
server IP 172.217.22.174
* all occurrences of the string "http://" have been changed to "htt???/"