Configura una base de datos de Cloud SQL para MySQL para CDC
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En esta página, se describe cómo configurar la captura de datos modificados (CDC) para transmitir datos desde una base de datos de Cloud SQL para MySQL a un destino compatible, como BigQuery o Cloud Storage.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-10 (UTC)"],[[["\u003cp\u003eBinary logging must be enabled for Cloud SQL for MySQL, as detailed in the point-in-time recovery documentation.\u003c/p\u003e\n"],["\u003cp\u003eSpecific database flags, including \u003ccode\u003enet_read_timeout\u003c/code\u003e, \u003ccode\u003enet_write_timeout\u003c/code\u003e, \u003ccode\u003ewait_timeout\u003c/code\u003e, \u003ccode\u003ebinlog_row_image\u003c/code\u003e, and \u003ccode\u003emax_allowed_packet\u003c/code\u003e, should be configured in the Cloud SQL instance settings, based on the chosen replication method.\u003c/p\u003e\n"],["\u003cp\u003eA dedicated Datastream user should be created in the MySQL database with appropriate permissions such as \u003ccode\u003eREPLICATION SLAVE\u003c/code\u003e, \u003ccode\u003eSELECT\u003c/code\u003e, and \u003ccode\u003eREPLICATION CLIENT\u003c/code\u003e to be able to be used by Datastream.\u003c/p\u003e\n"]]],[],null,["# Configure a Cloud SQL for MySQL database\n\nThe following sections cover how to configure a Cloud SQL for MySQL database to work with Datastream.\n\nEnable binary logging\n---------------------\n\n1. To enable binary logging for Cloud SQL for MySQL, see [Enabling point-in-time recovery](/sql/docs/mysql/backup-recovery/pitr#enablingpitr).\n\nConfigure database flags\n------------------------\n\n1. In Google Cloud console, go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql)\n2. Select the project that contains the Cloud SQL instance for which you want\n to set the database flags.\n\n3. Open the instance and click **Edit**.\n\n4. Go to the **Flags** section.\n\n5. Click **Add a database flag**.\n\n6. Choose the following flags from the drop-down menu, and set their values:\n\n - For **GTID-based** replication:\n\n - For **binlog-based** replication:\n\n7. Click **Save** to save your changes.\n\nCreate a Datastream user\n------------------------\n\n1. To create a Datastream user, enter the following MySQL commands:\n\n ```sql\n CREATE USER 'datastream'@'%' IDENTIFIED BY '\u003cvar translate=\"no\"\u003eYOUR_PASSWORD\u003c/var\u003e';\n GRANT REPLICATION SLAVE, SELECT, REPLICATION CLIENT ON *.* TO 'datastream'@'%';\n FLUSH PRIVILEGES;\n ```\n\nWhat's next\n-----------\n\n- Learn more about how Datastream works with [MySQL sources](/datastream/docs/sources-mysql)."]]