
## Crawl MySQL

URL: https://docs.atlan.com/apps/connectors/database/mysql/how-tos/crawl-mysql

> To crawl metadata from MySQL, review the [order of operations](/product/connections/how-tos/order-workflows) and then complete the following steps.

Once you have configured the [MySQL user permissions](https://docs.atlan.com/llms/connectors/mysql/set-up-mysql/llms.txt), you can establish a connection between Atlan and MySQL. (If you are also using a private network for MySQL, [set that up first](https://docs.atlan.com/llms/connectors/mysql/set-up-a-private-network-link-to-mysql/llms.txt).)

To crawl metadata from MySQL, review the [order of operations](https://docs.atlan.com/llms/catalog/connector-capabilities/order-workflows/llms.txt) and then complete the following steps.

## Create crawler workflow

Follow these steps to create a MySQL crawler workflow:

1. In your Atlan workspace, click **Connectors** in the left sidebar.
 * If you are using the **Old UI (Classic)**, click **New Workflow** in the top navigation.

2. Click **Marketplace**.

3. Search for **MySQL Assets** and select it.

4. Click **Install**.

5. Once installation completes, click **Setup Workflow** on the same tile.

### Configure extraction

Select your extraction method and provide the connection details.

:::warning Offline extraction sunset
The offline extraction method has been sunset and is no longer available. For on-premises or network-restricted environments, use the **Agent** extraction method with [Self-Deployed Runtime](https://docs.atlan.com/llms/platform/self-deployed-runtime/llms.txt).
:::

### Direct

In **Direct** extraction, Atlan connects to your database and crawls metadata directly.

1. Enter your MySQL connection details:
 - **Host Name**: Enter the host for your MySQL instance.
 - **Port**: Enter the port number of your MySQL instance (default is `3306`).

2. Choose an authentication method you configured when [setting up the MySQL user](https://docs.atlan.com/llms/connectors/mysql/set-up-mysql/llms.txt).

Use standard database credentials created in your MySQL instance.

- **Username**: Enter the username you configured in MySQL.
- **Password**: Enter the password for the specified user.

### IAM User authentication

Authenticate using AWS IAM user credentials for RDS or Aurora MySQL.

- **AWS Access Key**: Enter the AWS access key ID for the IAM user.
- **AWS Secret Key**: Enter the AWS secret access key for the IAM user.
- **Username**: Enter the database username you configured in MySQL.

### IAM Role authentication

Authenticate using AWS IAM role for RDS or Aurora MySQL.

- **AWS Role ARN**: Enter the ARN of the [IAM role you created](https://docs.atlan.com/llms/connectors/mysql/set-up-mysql/llms.txt).
- **Username**: Enter the database username you configured in MySQL.
- **AWS External ID** (optional): Enter the external ID only if you have configured an [external ID](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) in the role definition.

3. Click **Test Authentication** to confirm connectivity to MySQL using these details.

:::info
💪 **Did you know?** If you get an `Error: 1129: Host ... is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'`, ask your database admin to run the `FLUSH HOSTS;` command in the RDS instance, and then try again.
:::

4. When successful, at the bottom of the screen click **Next**.

### Agent

In **Agent** extraction, Self-Deployed Runtime executes metadata extraction within your organization's environment.

1. Install Self-Deployed Runtime if you haven't already:
 - [Install via Docker Compose](https://docs.atlan.com/llms/platform/self-deployed-runtime/install-on-docker-compose/llms.txt)
 - [Install on Kubernetes](https://docs.atlan.com/llms/platform/self-deployed-runtime/install-on-kubernetes/llms.txt)
2. Select the **Agent** tab.

3. Store sensitive information in the secret store configured with the Self-Deployed Runtime and reference the secrets in the corresponding fields. For more information, see [Secret management](https://docs.atlan.com/llms/platform/self-deployed-runtime/secret-management/llms.txt).

4. For details on individual fields, refer to the Direct extraction tab.

5. Click **Next** after completing the configuration.

### Configure connection

To complete the MySQL connection configuration:

1. Provide a _Connection Name_ that represents your source environment. For example, you might use values like `production`, `development`, `gold`, or `analytics`.

2. (Optional) To change the users able to manage this connection, change the users or groups listed under _Connection Admins_.

 :::warning

 If you don't specify any user or group, nobody can manage the connection - not even admins.

 :::

3. (Optional) To prevent users from querying any MySQL data, change _Allow SQL Query_ to **No**.

4. (Optional) To prevent users from previewing any MySQL data, change _Allow Data Preview_ to **No**.

5. At the bottom of the screen, click **Next** to proceed.

### Configure crawler

Before running the MySQL crawler, you can further configure it. (Some of the options may only be available when using the Direct extraction method.)

You can override the defaults for any of these options:

- To select the assets you want to include in crawling, click **Include Metadata**. (This defaults to all assets, if none are specified.)
- To select the assets you want to exclude from crawling, click **Exclude Metadata**. (This defaults to no assets if none are specified.)
- To have the crawler ignore tables and views based on a naming convention, specify a regular expression in the _Exclude regex for tables & views_ field.
- For _Advanced Config_, keep _Default_ for the default configuration or click **Custom** to configure the crawler:
 - For _Enable Source Level Filtering_, click **True** to enable schema-level filtering at source or click **False** to disable it.
 - For _Use JDBC Internal Methods_, click **True** to enable JDBC internal methods for data extraction or click **False** to disable it.

:::info **Did you know?** 
 If an asset appears in both the include and exclude filters, the exclude filter takes precedence.

:::

### Run crawler

To run the MySQL crawler:

1. (Direct mode only) To check for any [permissions or other configuration issues](https://docs.atlan.com/llms/connectors/mysql/preflight-checks-for-mysql/llms.txt) before running the crawler, click **Preflight checks**.

2. You can either:
 - To run the crawler once immediately, at the bottom of the screen, click the **Run** button.
 - To schedule the crawler to run hourly, daily, weekly, or monthly, at the bottom of the screen, click the **Schedule Run** button.

Once the crawler completes, you can see the assets in Atlan's asset page! 🎉

## See also

* [How Atlan connects to MySQL](https://docs.atlan.com/llms/connectors/mysql/how-atlan-connects-to-mysql/llms.txt): Connection protocols, ports, and security
* [What does Atlan crawl from MySQL](https://docs.atlan.com/llms/connectors/mysql/what-does-atlan-crawl-from-mysql/llms.txt): Assets and metadata discovered
* [Preflight checks for MySQL](https://docs.atlan.com/llms/connectors/mysql/preflight-checks-for-mysql/llms.txt): Prerequisites and validation

---
