<br />

Connection profiles capture identifiers for your source databases.
Each connection profile contains the
minimum required amount of information Database Migration Service needs to facilitate
data movement between the data source and destination.

To create a source connection profile, follow these steps:

### Console

1. Go to the [Connection Profiles](https://console.cloud.google.com/dbmigration/connection-profiles) page in the Google Cloud Console.
2. Click **Create profile**.
3. On the **Create a connection profile** page, from the **Profile role** list, select **Source**.
4. From the **Database engine** list, select your source database engine.

   > [!NOTE]
   > If you select **Cloud SQL for MySQL** from this Select the ID of the Cloud SQL instance that you want to migrate. list, then an **Instance ID** list appears.

5. In the **Connection profile name** field, enter a human-readable name for your connection profile. This value is displayed in the connection profile list.
6. Keep the auto-generated **Connection profile ID**.
7. Enter a **Hostname** or **IP address** .
   - The value you use here depends on the connectivity method you
     use for your migration. For example, if the source database is
     hosted in Google Cloud, or if a reverse SSH
     tunnel is used to connect the destination database to the source database,
     then specify the private (internal) IP address for the source database.
     For more information, see
     [Network connectivity overview](https://docs.cloud.google.com/database-migration/docs/mysql/networking-methods.md.txt).

   - MySQL limits the hostname to 60 characters. Amazon RDS database hostnames are typically longer than 60 characters. If this is the case for the database you're migrating, then configure a DNS redirect to create a CNAME record that associates your domain name with the domain name of your RDS DB instance. To learn more about setting up DNS CNAME, see [Set up DNS records for a domain name](https://docs.cloud.google.com/dns/docs/set-up-dns-records-domain-name.md.txt) in the Cloud DNS documentation, or check [Routing internet traffic to your AWS resources](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-resources.html) in the AWS documentation.
8. Enter the **Port** that's used to access the host. The default MySQL port is 3306.
9. Enter a username and password for the source database.
10. In the **Connection profile region** section of the page, select the region where you want to save the connection profile.

    > [!NOTE]
    > Connection profiles, like all resources, are saved in a region. Region selection doesn't impact which migration jobs can use them, or which regions can connect to the data location itself, but can impact availability in the case of regional downtime.

11. Click **Create**.

    The **Connection profiles** page appears, and the newly created connection profile is displayed.

### gcloud


This sample uses the optional `--no-async` flag so that all operations
are performed synchronously. This means that some commands might take
a while to complete. You can skip the `--no-async` flag to run commands asynchronously.
If you do, you need to use the
[`gcloud database-migration operations describe`](https://docs.cloud.google.com/sdk/gcloud/reference/database-migration/operations/describe.md.txt) command to verify if your operation
is successful.


Before using any of the command data below,
make the following replacements:

- <var class="edit" scope="CONNECTION_PROFILE_ID" translate="no">CONNECTION_PROFILE_ID</var> with a machine-readable identifier for your connection profile.
- <var class="edit" scope="REGION" translate="no">REGION</var> with the identifier of the region where you want to save the connection profile.
- <var class="edit" scope="HOST_IP_ADDRESS" translate="no">HOST_IP_ADDRESS</var> with the IP address where Database Migration Service can reach your source database instance. This value can vary depending on which [connectivity method](https://docs.cloud.google.com/database-migration/docs/mysql/networking-methods.md.txt) you use for your migration.
- <var class="edit" scope="PORT_NUMBER" translate="no">PORT_NUMBER</var> with the port number where your source database accepts incoming connections. The default MySQL port is 3306.
- <var class="edit" scope="USERNAME" translate="no">USERNAME</var> with the name of the database user account you want Database Migration Service to connect as to your source database instance.
- <var class="edit" scope="PASSWORD" translate="no">PASSWORD</var> with the password for the database user account.
- (Optional) <var class="edit" scope="CONNECTION_PROFILE_NAME" translate="no">CONNECTION_PROFILE_NAME</var> with a human-readable name for your connection profile. This value is displayed in the Google Cloud console.


Execute the

following

command:

#### Linux, macOS, or Cloud Shell

> [!NOTE]
> **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

```bash
gcloud database-migration connection-profiles \
create mysql CONNECTION_PROFILE_ID \
  --no-async \
  --region=REGION \
  --host=HOST_IP_ADDRESS \
  --port=PORT_NUMBER \
  --username=USERNAME \
  --password=PASSWORD \
  --display-name=CONNECTION_PROFILE_NAME
```

#### Windows (PowerShell)

> [!NOTE]
> **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

```bash
gcloud database-migration connection-profiles `
create mysql CONNECTION_PROFILE_ID `
  --no-async `
  --region=REGION `
  --host=HOST_IP_ADDRESS `
  --port=PORT_NUMBER `
  --username=USERNAME `
  --password=PASSWORD `
  --display-name=CONNECTION_PROFILE_NAME
```

#### Windows (cmd.exe)

> [!NOTE]
> **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

```bash
gcloud database-migration connection-profiles ^
create mysql CONNECTION_PROFILE_ID ^
  --no-async ^
  --region=REGION ^
  --host=HOST_IP_ADDRESS ^
  --port=PORT_NUMBER ^
  --username=USERNAME ^
  --password=PASSWORD ^
  --display-name=CONNECTION_PROFILE_NAME
```

You should receive a response similar to the following:

```
Waiting for connection profile [CONNECTION_PROFILE_ID]
to be created with [OPERATION_ID]

Waiting for operation [OPERATION_ID] to complete...done.

Created connection profile CONNECTION_PROFILE_ID [OPERATION_ID]
```

<br />

## What's next

- [Manage connection profiles](https://docs.cloud.google.com/database-migration/docs/mysql/manage-connection-profiles.md.txt)