Note: Google Cloud MySQL automatically manages its binary log retention period. By default, binary logs are purged after 7 days. If your connector is paused for more than 7 days, you may be required to re-sync your data.
Follow these instructions to replicate your Google Cloud MySQL database to your destination via Fivetran.
To connect your MySQL database to Fivetran, you need:
- MySQL version 5.6 or above.
NOTE: If you upgrade your database version to 8.0.23 or above, you must set the
MINIMALbefore you do the upgrade. If you set
MINIMALafter the upgrade, your existing Google Cloud MySQL connectors will fail and you may need re-sync them.
- Your database host’s IP (for example,
126.96.36.199) or domain (
- Your database’s port (usually
- TLS enabled on your database (if you want to connect to Fivetran directly)
- A unique replica ID for Fivetran. We need this ID because we connect to your database as a replica. We provide a random replica ID in your setup form, but you can provide your own if you’d prefer or if the form’s replica ID conflicts with one of your existing replica IDs.
NOTE: The replica ID is a unique ID within the MySQL replica set. By default, the replica ID is a random integer greater than 1000.
For the prerequisites for connecting via an SSH tunnel, see Fivetran’s Connection Options page.
Choose your connection optionlink
Google Cloud MySQL products require client certificates to connect to a database that is configured to require SSL. Fivetran only supports Server Certificate authentication.
To connect Fivetran to your Google Cloud MySQL product, you must perform either of these two actions:
- Select the Allow Unsecured Connections option from the Connections tab of your Cloud SQL instance.
- Create a Google Cloud Virtual Machine to act as a proxy to connect using one of these options:
Allow access to masterlink
Your Google Cloud MySQL master server needs to be made accessible to Fivetran’s data processing server.
In your MySQL Dashboard, select the “Master” instance you would like to use.
Note the Master IP address and port number (3306 by default).
Add Fivetran’s IP addresses to access the port number of your master node unless you already have 0.0.0.0/0 as an allowed network.
Check that binary logging is enabled (optional)link
By default, Google enables binary logging through point-in-time recovery for MySQL master databases. To confirm that binary logging is enabled on your database, follow the steps below.
In your MySQL Dashboard, click Backups in the left menu.
In the Settings section, confirm that Enable point-in-time recovery is set to Enabled.
If point-in-time recovery is disabled, you must enable it. Click Edit.
In the Edit backups settings window, select the Enable point-in-time recovery box to enable binary logging.
NOTE: Your Cloud SQL instance will restart when you enable point-in-time recovery.
Next, you must create a Fivetran user in your Google Cloud MySQL database. Make sure to do this on the master node because replicas are read-only.
WARNING: This user must be reserved for Fivetran use only and must be unique to your connector. For more information, see our MySQL documentation.
Open a connection to your Google Cloud MySQL database using your favorite SQL tool (for example, MySQL Workbench or the “mysql” command in your operating system’s terminal window).
Create a Fivetran user and grant replication permissions by running the following SQL commands. Replace
passwordwith a username and password of your choice…
CREATE USER '<username>'@'%' IDENTIFIED BY 'password'; GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO '<username>'@'%';
Choose schema prefixlink
Each schema from your source database will be mapped to a schema in the destination by adding a prefix to the original schema name. For example, if your original database contains schemas “foo” and “bar” and if you choose the prefix “pre”, then you will get schemas “pre_foo” and “pre_bar” in the output.
Fivetran performs the following tests to ensure that we can connect to your Google Cloud MySQL database and that it is properly configured:
- The Connecting to SSH Tunnel Test validates the SSH tunnel details you provided in the setup form. It generates a pop-up window where you must verify the SSH fingerprint. It then checks that we can connect to your database using the SSH Tunnel. (We skip this test if you are connecting directly.)
- The Connecting to Host Test verifies that the database host is not private and checks that we can connect to the host.
- The Validating Certificate Test generates a pop-up window where you must choose which certificate you want Fivetran to use. It then validates that certificate and checks that we can connect to your database using TLS. (We skip this test if you are connecting using an SSH tunnel and did not choose to require TLS.)
- The Validating Database User Test validates the database credentials you provided in the setup form.
- The Checking Database Configuration Test verifies that we can find your database’s server ID. It then checks your binary log configuration and confirms that we can connect to the binary log.
- The Validating Database Type Test checks that your database type matches the connector type. For example, this test will fail if you try to set up a Google Cloud MySQL connector with a MySQL RDS database.
NOTE: The tests may take a few minutes to finish running.