Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

770
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda