This page describes how to configure change data capture (CDC) to stream data from a Cloud SQL for MySQL database to a supported destination , such as BigQuery or Cloud Storage.
Enable binary logging
- To enable binary logging for Cloud SQL for MySQL, see Enabling point-in-time recovery .
Configure database flags
-
In Google Cloud console, go to the Cloud SQL Instances page.
-
Select the project that contains the Cloud SQL instance for which you want to set the database flags.
-
Open the instance and click Edit.
-
Go to the Flagssection.
-
Click Add a database flag.
-
Choose the following flags from the drop-down menu, and set their values:
-
For GTID-basedreplication:
Parameter Value net_read_timeout 3600net_write_timeout 3600wait_timeout 86400binlog_row_image FULLmax_allowed_packet 1073741824(recommended value) -
For binlog-basedreplication:
Flag Value net_read_timeout 3600net_write_timeout 3600wait_timeout 86400
-
-
Click Saveto save your changes.
Create a Datastream user
-
To create a Datastream user, enter the following MySQL commands:
CREATE USER 'datastream' @ '%' IDENTIFIED BY ' YOUR_PASSWORD ' ; GRANT REPLICATION SLAVE , SELECT , REPLICATION CLIENT ON * . * TO 'datastream' @ '%' ; FLUSH PRIVILEGES ;
What's next
- Learn more about how Datastream works with MySQL sources .

