Skip to main content
Skip to main content
Edit this page

Cloud SQL for MySQL source setup guide

This is a step-by-step guide on how to configure your Cloud SQL for MySQL instance for replicating its data via the MySQL ClickPipe.

Enable binary log retention

The binary log is a set of log files that contain information about data modifications made to an MySQL server instance, and binary log files are required for replication.

Enable binary logging via PITR

The PITR feature determines whether binary logging is turned on or off for MySQL in Google Cloud. It can be set in the Cloud console, by editing your Cloud SQL instance and scrolling down to the below section.

Setting the value to a reasonably long value depending on the replication use-case is advisable.

If not already configured, make sure to set these in the database flags section by editing the Cloud SQL:

  1. binlog_expire_logs_seconds to a value >= 86400 (1 day).
  2. binlog_row_metadata to FULL
  3. binlog_row_image to FULL

To do this, click on the Edit button in the top right corner of the instance overview page.

Then scroll down to the Flags section and add the above flags.

Configure a database user

Connect to your Cloud SQL MySQL instance as the root user and execute the following commands:

  1. Create a dedicated user for ClickPipes:

  2. Grant schema permissions. The following example shows permissions for the clickpipes database. Repeat these commands for each database and host you want to replicate:

  3. Grant replication permissions to the user:

Configure network access

If you want to restrict traffic to your Cloud SQL instance, please add the documented static NAT IPs to the allowlisted IPs of your Cloud SQL MySQL instance. This can be done either by editing the instance or by heading over to the Connections tab in the sidebar in Cloud Console.

Download and Use Root CA certificate

To connect to your Cloud SQL instance, you need to download the root CA certificate.

  1. Go to your Cloud SQL instance in the Cloud Console.
  2. Click on Connections in the sidebar.
  3. Click on the Security tab.
  4. In the Manage server CA certificates section, click on the DOWNLOAD CERTIFICATES button at the bottom.
  1. In the ClickPipes UI, upload the downloaded certificate when creating a new MySQL ClickPipe.