allow-materialize-ips.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 1. In the [SQL Shell](https://console.materialize.com/), or your preferred SQL
  2. client connected to Materialize, use the [`CREATE SECRET`](/sql/create-secret/)
  3. command to securely store the password for the `materialize` MySQL user
  4. you created [earlier](#2-create-a-user-for-replication):
  5. ```mzsql
  6. CREATE SECRET mysqlpass AS '<PASSWORD>';
  7. ```
  8. For AWS IAM authentication, you must create a connection to AWS. See the [`CREATE CONNECTION`](/sql/create-connection/#aws) command for details.
  9. 1. Use the [`CREATE CONNECTION`](/sql/create-connection/) command to create a
  10. connection object with access and authentication details for Materialize to
  11. use:
  12. ```mzsql
  13. CREATE CONNECTION mysql_connection TO MYSQL (
  14. HOST <host>,
  15. PORT 3306,
  16. USER 'materialize',
  17. PASSWORD SECRET mysqlpass,
  18. SSL MODE REQUIRED
  19. );
  20. ```
  21. - Replace `<host>` with your MySQL endpoint.
  22. AWS IAM authentication is also available, see the [`CREATE CONNECTION`](/sql/create-connection/#mysql) command for details.
  23. 1. Use the [`CREATE SOURCE`](/sql/create-source/) command to connect Materialize
  24. to your MySQL instance and start ingesting data:
  25. ```mzsql
  26. CREATE SOURCE mz_source
  27. FROM mysql CONNECTION mysql_connection
  28. FOR ALL TABLES;
  29. ```
  30. - By default, the source will be created in the active cluster; to use a
  31. different cluster, use the `IN CLUSTER` clause.
  32. - To ingest data from specific schemas or tables, use the `FOR SCHEMAS
  33. (<schema1>,<schema2>)` or `FOR TABLES (<table1>, <table2>)` options
  34. instead of `FOR ALL TABLES`.
  35. - To handle unsupported data types, use the `TEXT COLUMNS` or `IGNORE
  36. COLUMNS` options. Check out the [reference documentation](/sql/create-source/mysql/#supported-types)
  37. for guidance.
  38. 1. After source creation, you can handle upstream [schema changes](/sql/create-source/mysql/#schema-changes)
  39. by dropping and recreating the source.