Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

GCP SQL

TagDev
New Member

GCP instance is connected to GCP SQL, But it does not allow insert operation on database, where as other operations like select, update and delete is working.

0 1 100
1 REPLY 1

Hi @TagDev,

Welcome to Google Cloud Community!

The issue with insert operation on a GCP SQL database may be due to a variety of reasons, such as:

  1. Permissions: The user connecting to the database may not have the necessary permissions to perform insert operations.
  2. Firewall: The firewall settings may be blocking the insert operation.
  3. Table constraints: There may be constraints on the table that are preventing the insert operation.
  4. Triggers: There may be triggers on the table that are preventing the insert operation.
  5. Active transaction: An active transaction may be preventing the insert operation.
  6. Table is read-only: the table may be read-only, which means no insert operations are allowed.

It is recommended to check the above possible causes and fix the issue. Also, check the error message that is thrown when the insert operation is performed, it will give more information on the specific error.

You can refer to the following documentation for more information on troubleshooting insert operations on a GCP SQL database:

  1. Permissionshttps://cloud.google.com/sql/docs/mysql/create-manage-users#permissions
  2. Firewallhttps://cloud.google.com/sql/docs/mysql/configure-firewall-rules
  3. Table constraintshttps://dev.mysql.com/doc/refman/8.0/en/constraints.html
  4. Triggershttps://dev.mysql.com/doc/refman/8.0/en/triggers.html
  5. Active transactionhttps://dev.mysql.com/doc/refman/8.0/en/commit.html
  6. Table is read-onlyhttps://dev.mysql.com/doc/refman/8.0/en/table-types.html

Also, you can check the following link for more information about troubleshooting SQL instances on GCP: https://cloud.google.com/sql/docs/troubleshoot

Thank you