1. In the [SQL Shell](https://console.materialize.com/), or your preferred SQL client connected to Materialize, use the [`CREATE SECRET`](/sql/create-secret/) command to securely store the password for the `materialize` MySQL user you created [earlier](#2-create-a-user-for-replication): ```mzsql CREATE SECRET mysqlpass AS ''; ``` For AWS IAM authentication, you must create a connection to AWS. See the [`CREATE CONNECTION`](/sql/create-connection/#aws) command for details. 1. Use the [`CREATE CONNECTION`](/sql/create-connection/) command to create a connection object with access and authentication details for Materialize to use: ```mzsql CREATE CONNECTION mysql_connection TO MYSQL ( HOST , PORT 3306, USER 'materialize', PASSWORD SECRET mysqlpass, SSL MODE REQUIRED ); ``` - Replace `` with your MySQL endpoint. AWS IAM authentication is also available, see the [`CREATE CONNECTION`](/sql/create-connection/#mysql) command for details. 1. Use the [`CREATE SOURCE`](/sql/create-source/) command to connect Materialize to your MySQL instance and start ingesting data: ```mzsql CREATE SOURCE mz_source FROM mysql CONNECTION mysql_connection FOR ALL TABLES; ``` - By default, the source will be created in the active cluster; to use a different cluster, use the `IN CLUSTER` clause. - To ingest data from specific schemas or tables, use the `FOR SCHEMAS (,)` or `FOR TABLES (, )` options instead of `FOR ALL TABLES`. - To handle unsupported data types, use the `TEXT COLUMNS` or `IGNORE COLUMNS` options. Check out the [reference documentation](/sql/create-source/mysql/#supported-types) for guidance. 1. After source creation, you can handle upstream [schema changes](/sql/create-source/mysql/#schema-changes) by dropping and recreating the source.