# Dump & import Mysql database inside container

```bash
# backup

MYSQL_CONTAINER=$(docker ps --filter ancestor=mysql:5.7 -q)
docker exec $MYSQL_CONTAINER /usr/bin/mysqldump -u root --password=your_db_password your_backup_db | gzip > your_backup_db.$(date +%F.%H%M%S).sql.gz


# Restore
cat your_backup_db.sql | docker exec -i $MYSQL_CONTAINER /usr/bin/mysql -u your_db_username --password=your_db_password your_target_db
```


---

# Agent Instructions: 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:

```
GET https://dev-notes.vinguyen.blog/notes/deployment-and-operation/database/mysql/dump-and-import-mysql-database-inside-container.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
