Mengonfigurasi database Cloud SQL untuk MySQL untuk CDC
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara mengonfigurasi pengambilan data perubahan (CDC) untuk mengalirkan data dari database Cloud SQL untuk MySQL ke tujuan yang didukung, seperti BigQuery atau Cloud Storage.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]