Découvrez comment Datastream fonctionne avec les sources MySQL.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (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)."]]