Diagnose issues Stay organized with collections Save and categorize content based on your preferences.
This page contains a list of the most frequent issues you might run intowhen working with Cloud SQL instances and steps you can take to addressthem. Also review theKnown issues,Troubleshooting, andSupport page pages.
View logs
To see information about recent operations, you can view theCloud SQL instance operation logsor theMySQL error logs.
Instance unresponsive
If your instance stops responding to connections or performance is degraded,make sure it conforms to theOperational Guidelines. If it does notconform to these guidelines, it is not covered bytheCloud SQL SLA.
Connection issues
See theDebugging connectionissues page or theConnectivity section in the troubleshooting page for help with connectionproblems.
Instance issues
Backups
For the best performance forbackups, keep thenumber of tables to a reasonable number.
For other backups issues, see theBackups section in the troubleshooting page.
Import and export
Imports and exports in Cloud SQL are thesame as using themysqldump utility, except that with the Cloud SQLimport/export feature, you transfer data using a Cloud Storage bucket.
Imports into Cloud SQL and exports out of Cloud SQL can take a long time to complete, depending on the size of the data being processed. This can have the following impacts:
- You can't stop a long-running Cloud SQL instance operation.
- You can perform only one import or export operation at a time for each instance, and a long-running import or export blocks other operations, such as daily automated backups. Serverless exports allow you to run other operations, including editing instances, import, failover, and unblocking daily automated backups.
You can decrease the amount of time it takes to complete each operation by using the Cloud SQL import or export functionality with smaller batches of data.
For exports, you can perform the export from aread replica or useserverless export to minimize the impact on database performance and allow other operations to run on your instance while an export is running.
Note: Serverless export costs extra. See thepricing page.Other points to keep in mind when importing:
- If your import is crashing, it could be due to an out-of-memory (OOM) error.If this is the case, you can try using MySQL commands directly to add the
--extended-insert=FALSE --complete-insertparameters. These parameters reducethe speed of your import, but also reduce the amount of memory the importrequires.
For other import and export issues, see theImport and export section in the troubleshooting page.
Disk space
If your instance reaches the maximum storage amount allowed, writes tothe database fail. If you delete data, for example, by dropping atable, the space freed is not reflected in the reportedStorage Used of the instance. See the FAQHow can I reclaim the space from a dropped table?for an explanation of this behavior.Reaching the maximum storage limit can also cause the instance to get stuck inrestart.
Avoid data corruption
Avoid generated columns
Due to an issue in MySQL, using generated columns might result in datacorruption. For more information, seeMySQL bug #82736.
Clean shutdowns
When Cloud SQL shuts down an instance (e.g, for maintenance), no new connectionsare sent to the instance and existing connections are ended. The amount oftime mysqld has to shutdown is capped to 1 minute. If the shutdown does notcomplete in that time, the mysqld process is forcefully stopped. This canresult in disk writes being aborted mid-way through.
Database engines
InnoDB is the only supported storage engine for MySQL instancesbecause it is more resistant to table corruption than other MySQL storageengines, such asMyISAM.
By default, Cloud SQL database tables are created using the InnoDB storageengine. If yourCREATE TABLE syntax includes anENGINEoption specifying a storage engine other than InnoDB, for exampleENGINE = MyISAM, the table is not created and you see error messageslike the following example:
ERROR3161(HY000):StorageengineMyISAMisdisabled(Tablecreationisdisallowed).You can avoid this error by removing theENGINE = MyISAM option from theCREATE TABLE command. Doing so creates the table with the InnoDB storageengine.
Changes to system tables
MySQL system tables use the MyISAM storage engine, including all tables in themysql database, for examplemysql.user andmysql.db. These tables arevulnerable to unclean shutdowns; issue theFLUSH CHANGES commandafter making changes to these tables. If MyISAM corruptiondoes occur,CHECK TABLE andREPAIR TABLE can get you back to good state(but not save data).
Global Transaction Identifiers (GTID)
All MySQL instances have GTID enabled automatically. Having GTIDenabled protects against data loss during replica creation and failover, andmakes replication more robust. However, GTID comes with some limitationsimposed by MySQL, as documented in theMySQL manual.The following transactionally unsafe operations cannot be used with aGTID-enabled MySQL server:
CREATE TABLE ... SELECTstatements;CREATE TEMPORARY TABLEstatements inside transactions;- Transactions or statements that affect both transactional and non-transactional tables.
If you use a transactionally unsafe transaction, you see an error messagelike the following example:
Exception:SQLSTATE[HY000]:Generalerror:1786CREATETABLE...SELECTisforbiddenwhen@@GLOBAL.ENFORCE_GTID_CONSISTENCY=1.Work with triggers and stored functions
If your instance has binary logging enabled, and you need to work withtriggers or stored functions, make sure your instance has thelog_bin_trust_function_creators flagset toon.
Suspended state
There are various reasons why Cloud SQL may suspend an instance,including:
Billing issues
For example, if the credit card for the project's billing account hasexpired, the instance may be suspended. You can check the billinginformation for a project by going to the Google Cloud consolebilling page, selecting the project, and viewingthe billing account information used for the project. After you resolvethe billing issue, the instance returns to runnable status withina few hours.
Key issues with Cloud Key Management Service
For example, if the key version of the Cloud KMS that's used to encrypt the user data in the Cloud SQL instance isn't present, access to the key is revoked, or if the key is deactivated, deleted or unreachable for several hours after multiple retries. For more information, seeUsing customer-managed encryption keys (CMEK).
Legal issues
For example, a violation of theGoogle Cloud Acceptable Use Policy may cause theinstance to be suspended. For more information, see "Suspensions andRemovals" in theGoogle Cloud Terms of Service.
Operational issues
For example, if an instance is stuck in a crash loop (it crasheswhile starting or just after starting), Cloud SQL may suspend it.
While an instance is suspended, you can continue to view information about itor you can delete it, if billing issues triggered the suspension.
Cloud SQL users with Platinum, Gold, or Silversupport packages can contact our support team directly aboutsuspended instances. All users can use the earlier guidance along with thegoogle-cloud-sql forum.
Performance
Overview
Cloud SQL supports performance-intensive workloads with up to 60,000 IOPSand no extra cost for I/O. IOPS and throughput performance depends on disk size,instance vCPU count, and I/O block size, among other factors.
Your instance's performance also depends on yourchoice of storage type andworkload.
Learn more about:
- Persistent disks and performance.
- Performance and throttling metrics.
- Optimizing disk performance.
- Other factors that affect performance.
Enable query logs
To tune the performance of your queries, you can configureCloud SQL to log slow queries byadding the database flags--log_output='FILE' and--slow_query_log=on to your instance.This makes the log output available using theLogs Viewer in the Google Cloud console.Note thatGoogle Cloud Observability logging charges apply.
Do not set log_output toTABLE. Doing so can cause connection issues asdescribed inTips for working with flags.
You can refer tothis tutorialfor instructions to log and monitor Cloud SQL for MySQL slow queries usingCloud Logging and Monitoring.
Enable lock monitoring
InnoDB monitors provide information about the InnoDB storage engine's internalstate, which you can use in performance tuning.
Access the instance using MySQL Client and obtain on-demand monitor output:
SHOWENGINEINNODBSTATUS\G
For explanations of the sections in the monitor output, seeInnoDB Standard Monitor and Lock Monitor Output.
You can enable InnoDB monitors so that output is generated periodically toa file or a table, with performance degradation. For more information, seeEnabling InnoDB Monitors.
Use performance schema
TheMySQL Performance Schema is afeature for monitoring MySQL Server execution at a low level. The most accessibleway to consume the stats generated in performance_schema is throughMySQL WorkbenchPerformance Reports functionality.
Keep a reasonable number of database tables
Database tables consume system resources. A large numbercan affect instance performance and availability, and cause the instance tolose its SLA coverage.Learn more.
General performance tips
.For slow database inserts, updates, or deletes, consider the followingactions:- Check the locations of the writer and database; sending data a long distanceintroduces latency.
For slow database selects, consider the following:
- Caching is important for read performance. Compare the size of yourdataset to the size of RAM of your instance. Ideally, the entire datasetfits within 70% of the instance's RAM, in which case queries are notconstrained to IO performance. If not, consider increasing thesize of your instance's RAM.
- If your workload consists of CPU intensive queries (sorting, regularexpressions, other complex functions), your instance might be throttled;increase the vCPUs.
If you observe poor performance executing queries, useEXPLAIN. EXPLAIN is a statement you add toother statements, like SELECT, and it returns information about how MySQLexecutes the statement. It works with SELECT, DELETE, INSERT, REPLACE, andUPDATE. For example,EXPLAIN SELECT * FROM myTable;.
UseEXPLAIN to identify where you can:
Add indexes to tables to improve query performance. For example, make sureevery field that you use as a JOIN key has an index on both tables.
Improve
ORDER BYoperations. IfEXPLAINshows"Using temporary; Using filesort" in theExtra column of the output, thenintermediate results are stored in a file that is then sorted, whichusually results in poor performance. In this case, take one of the followingsteps:If possible, use indexes rather than sorting. SeeORDER BY Optimization formore information.
Increase the size of the
sort_buffer_sizevariable for the query session.Use less RAM per row by declaring columns only as large as required.
Troubleshoot
For other Cloud SQL issues, see thetroubleshooting page.
Error messages
For specific API error messages, see theError messages reference page.
Troubleshoot customer-managed encryption keys (CMEK)
Cloud SQL administrator operations, such as create, clone, or update, might fail due to Cloud KMS errors, and missing roles or permissions. Common reasons for failure include a missing Cloud KMS key version, a disabled or destroyed Cloud KMS key version, insufficient IAM permissions to access the Cloud KMS key version, or the Cloud KMS key version is in a different region than the Cloud SQL instance. Use the following troubleshooting table to diagnose and resolve common problems.
Customer-managed encryption keys troubleshooting table
| For this error... | The issue might be... | Try this... |
|---|---|---|
| Per-product, per-project service account not found | The service account name is incorrect. | Make sure you created a service account for the correct user project. |
| Cannot grant access to the service account | The user account does not have permission to grant access to this key version. | Add theOrganization Administrator role to your user or service account. |
| Cloud KMS key version is destroyed | The key version is destroyed. | If the key version is destroyed, you cannot use it to encrypt or decrypt data. |
| Cloud KMS key version is disabled | The key version is disabled. | Re-enable the Cloud KMS key version. |
| Insufficient permission to use the Cloud KMS key | Thecloudkms.cryptoKeyEncrypterDecrypter role is missing on the user or service account you are using to run operations on Cloud SQL instances, or the Cloud KMS key version doesn't exist. | In the Google Cloud project that hosts the key, add thecloudkms.cryptoKeyEncrypterDecrypter role to your user or service account.If the role is already granted to your account, seeCreating a key to learn how to create a new key version. See note. |
| Cloud KMS key is not found | The key version does not exist. | Create a new key version. SeeCreating a key. See note. |
| EKM key is unreachable | The External Key Manager (EKM) key is unreachable for several hours. Even after multiple retries, the EKM key remains unreachable. | Verify EKM connection status and troubleshoot the issue with your EKM provider. |
| Cloud SQL instance and Cloud KMS key version are in different regions | The Cloud KMS key version and Cloud SQL instance must be in the same region. It does not work if the Cloud KMS key version is in a global region or multi-region. | Create a key version in the same region where you want to create instances. SeeCreating a key. See note. |
| Cloud KMS key version is restored but instance is still suspended | The key version is disabled or doesn't grant proper permissions. | Re-enable the key version, and grant thecloudkms.cryptoKeyEncrypterDecrypter role to your user or service account in the Google Cloud project that hosts the key. |
create operation, you must delete it, add the role to the account you are using, and create a new instance with an active Cloud KMS key version.Re-encryption troubleshooting table
| For this error... | The issue might be... | Try this... |
|---|---|---|
| CMEK resource re-encryption failed because the Cloud KMS key is inaccessible. Please ensure that the primary key version is enabled and the permission is granted properly. | The key version is disabled or doesn't grant proper permissions. | Re-enable the Cloud KMS key version: In the Google Cloud project that hosts the key, confirm the |
| CMEK resource re-encryption failed due to server internal error. Please retry later | There is a server internal error. | Retry re-encryption. For more information, seeRe-encrypt an existing CMEK-enabled instance or replica |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-17 UTC.