# Create Data Source (Upstream Database)

__*Using DM*__
__*DM source database*__
__*DM upstream database*__

```
$ tiup dmctl --master-addr <master-addr> operate-source create ./source-mysql-01.yaml

source-id: "mysql-replica-01"

enable-gtid: false

relay-binlog-name: ""
relay-binlog-gtid: ""

from:
  host: "127.0.0.1"
  port: 3306
  user: "root"
  password: "ZqMLjZ2j5khNelDEfDoUhkD5aV5fIJOe0fiog9w="

```
-------------------------------------------------------------
Use command `create` to create one or more upstream database sources. When creating multiple data sources fails, an attempt is made to roll back to the state before the command was executed.

The configuration information of the upstream database (source database) is saved to `conf/sourcen.yaml`. The file mainly contains information such as the source database IP, port number, user name, password, GTID setting, relay log setting, etc.

The example file is as follows, assuming it is the first instance of MySQL:

```
source-id: "mysql-replica-01"

enable-gtid: false

relay-binlog-name: ""     # Upstream database binlog file name
relay-binlog-gtid: ""     # Upstream database binlog GTID

from:
  host: "127.0.0.1"
  port: 3306
  user: "root"
  password: "ZqMLjZ2j5khNelDEfDoUhkD5aV5fIJOe0fiog9w="
```

Execute the following command in the terminal to load MySQL data source configuration into DM cluster using tiup dmctl:

```
tiup dmctl --master-addr 172.16.10.71:8261 operate-source create conf/source1.yaml
```

Output:
```
{
    "result": true,
    "msg": "",
    "sources": [
        {
            "result": true,
            "msg": "",
            "source": "mysql-replica-01",
            "worker": "dm-worker-1"
        }
    ]
}
```

For the Nth instance of MySQL, modify the relevant information in the configuration file and execute the same dmctl command.

