Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

768
Views
docker - how to migrate mysql data from local to ec2 instance

In local environment, I am using docker-compose file to create multiple containers, including mysql container.
The data of mysql container is stored in ./db-data.
There are 4 tables in the database, e.g. Table A,B,C,D.

In Development environment, I've created an ec2 instance and used same docker-compose file to create containers, while the mysql database is managed be Aws RDS.

I want to copy all the data of Table A and B from local to development environment, but I wonder how can I achieve this?

docker-compose.yml

version: '2.1'

services:
  test-db:
    image: mysql:5.7
    environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=true
      - MYSQL_USER=admin
      - MYSQL_PASSWORD=12345
      - MYSQL_DATABASE=test
    volumes:
      - ./db-data:/var/lib/mysql
    ports:
      - 3306:3306
  test-web:
    environment:
      - NODE_ENV=local
      #- DEBUG=*
      - PORT=3030
    build: .
    command: >
      ./wait-for-db-redis.sh test-db npm run dev
    ports:
      - "3030:3030"
    depends_on:
      - test-db
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

If you want to migrate your data from mysql on the instance to RDS mysql, probably mysqldump would be the easiest choice as explained in the AWS docs:

  • Importing data from a MySQL or MariaDB DB to a MySQL or MariaDB DB instance

You can also import data from an existing MySQL or MariaDB database to a MySQL or MariaDB DB instance. You do so by copying the database with mysqldump and piping it directly into the MySQL or MariaDB DB instance.

There are other options to consider if basic mysqldump does not suit you, depending on your requirements. For example migrating live database with minimal downtime, or using Percona XtraBackup software as explained in AWS docs as well, or even AWS database migration service.

over 4 years ago · Santiago Trujillo Report

0

In addition to Marcin answer, if you are using MYSQLWorkbench you can do the following:

  1. Run SELECT * FROM <Your table name>; in the table you want to extract the data
  2. Click the Export button in Result Grid
  3. Choose SQL Insert statements in Format
  4. You can then get a list of SQL Insert statement. enter image description here
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!