> For the complete documentation index, see [llms.txt](https://docs.vngcloud.vn/vng-cloud-document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vngcloud.vn/vng-cloud-document/vdb/relational-database-service-rds/working-with-rds/cau-hinh-replication-voi-rds-mysql-mariadb.md).

# Configuring Replication with RDS (MySQL/MariaDB)

To synchronize data between your MySQL server and the RDS Instance, you can set up MySQL Replication. In this configuration, your MySQL server will act as the Master, and the RDS Instance will act as the Slave Read-Only. After successful configuration, any changes on your MySQL server will be synchronized to the RDS Instance via MySQL Asynchronous Replication.

#### Steps to configure Replication:

***

#### 1. **Create Replication User on Your MySQL Server**

On your MySQL server, create a user to handle the replication:

```sql
mysql> create user 'rep'@'%' identified by 'abcd1234';
mysql> grant replication slave on *.* to 'rep'@'%';
mysql> flush privileges;
```

* `rep` is the replication user.
* `abcd1234` is the password for the user.

***

#### 2. **Check the Binary Log Status on Your DB Server**

MySQL requires binary logs for replication. To check if binary logs are enabled, run the following query:

```sql
mysql> show variables like "log_bin";
```

* If the result is **OFF**, you need to enable the binary log. To do so, add the following lines to the configuration file `my.cnf` (typically located at `/etc/mysql/my.cnf`):

```ini
[mysqld]
log-bin=bin.log
log-bin-index=bin-log.index
max_binlog_size=100M
binlog_format=row
```

Then, restart the MySQL/MariaDB service:

```bash
systemctl restart mysql
```

Check again with:

```sql
mysql> show variables like "log_bin";
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.vngcloud.vn/vng-cloud-document/vdb/relational-database-service-rds/working-with-rds/cau-hinh-replication-voi-rds-mysql-mariadb.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
