> 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/vn/vdb/relational-database-service-rds/working-with-rds/import-du-lieu-vao-rds-instance-mysql-mariadb-bang-mysqldump.md).

# Import dữ liệu vào RDS Instance (MySQL/Mariadb) bằng MySQLDump

Để nạp dữ liệu (import) vào RDS Instance với datastore MySQL/Mariadb, bạn có thể sử dụng công cụ **mysqldump**.

Bạn có thể tự thực hiện thông qua các bước sau:

* [1. Dump dữ liệu từ MySQL server của bạn:](#importdulieuvaordsinstance-mysql-mariadb-bangmysqldump-1.dumpdulieutumysqlservercuaban)
* [2. Import dữ liệu vào RDS Instance.](#importdulieuvaordsinstance-mysql-mariadb-bangmysqldump-2.importdulieuvaordsinstance)

### 1. Dump dữ liệu từ MySQL server của bạn: <a href="#importdulieuvaordsinstance-mysql-mariadb-bangmysqldump-1.dumpdulieutumysqlservercuaban" id="importdulieuvaordsinstance-mysql-mariadb-bangmysqldump-1.dumpdulieutumysqlservercuaban"></a>

Trên MySQL server của bạn, bạn có thể lấy danh sách database mình hiện có bằng lệnh sau:

| `mysql> show databases;` |
| ------------------------ |

<figure><img src="https://docs.vngcloud.vn/download/thumbnails/10880027/Screenshot%20from%202019-10-30%2017-44-08.png?version=2&#x26;modificationDate=1572432342000&#x26;api=v2" alt=""><figcaption></figcaption></figure>

<br>

\
Xác định các database cần import ví dụ như trong hình là: *mysql02, mysql03, mysql04*.

**Lưu ý:** RDS Instance không hỗ trợ import các database hệ thống như: **mysql, performance\_schema, information\_schema và sys**. Bạn vui lòng bỏ qua các database này.

Sau khi đã có danh sách các database cần chuyển, bạn có thể dump dữ liệu bằng mysqldump với format tham khảo sau:

| `mysqldump -h<Local_DB_IP> -P<Local_DB_Port> -u<Local_DB_User> -p \--single-transaction \--routines --triggers \--databases <Your_DB_List >> dump-database.sql` |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- |

trong đó:

* Local\_DB\_IP: IP MySQL Server của bạn.
* Local\_DB\_Port: Port MYSQL Server của bạn
* Local\_DB\_User: User trên MySQL Server của bạn.
* Your\_DB\_LIst: danh sách các database bạn muốn dump cách nhau bởi dấu khoảng trắng. VD: *mysql02, mysql03, mysql04*

Kết quả bạn sẽ có một file **dump-database.sql** chứa dữ liệu sẽ import.

### 2. Import dữ liệu vào RDS Instance. <a href="#importdulieuvaordsinstance-mysql-mariadb-bangmysqldump-2.importdulieuvaordsinstance" id="importdulieuvaordsinstance-mysql-mariadb-bangmysqldump-2.importdulieuvaordsinstance"></a>

Để thực hiện import, bạn sử dụng Master User được cấp khi khởi tạo RDS Instance.

Bạn có thể dùng lệnh:

| `mysql -h<RDS Instance_IP> -P3306 -u<RDS Instance_Master_User> -p < dump-database.sql` |
| -------------------------------------------------------------------------------------- |

với:

* RDS Instance\_IP: IP của RDS Instance
* RDS Instance\_Master\_User: Master User được cấp khi khởi tạo RDS Instance.\ <br>

Tùy vào lượng dữ liệu của bạn mà thời gian import có thể kéo dài hay không.

Trên đây là hướng dẫn Import dữ liệu vào RDS Instance datastore MySQL/Mariadb. Chúc bạn thực hiện thành công.

<br>


---

# 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/vn/vdb/relational-database-service-rds/working-with-rds/import-du-lieu-vao-rds-instance-mysql-mariadb-bang-mysqldump.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.
