Installation

Database Dump Restoration Process

This article provides a step-by-step guide to restoring a database dump in AWS RDS or Azure MySQL. It covers stopping services, connecting to MySQL, creating the database, restoring data, and verifying the process. 

Following these steps ensures a smooth and accurate database recovery.

Prerequisites

  • Set up an AWS RDS or Azure MySQL instance.
  • Install the MySQL client on your machine.
  • Ensure you have administrative access to MySQL.

Steps to Restore the Database

  • Stop Docker Compose
    • Stop the running services by executing:

sudo docker-compose down

  • Connect to the MySQL Instance
    • Use the MySQL client to connect to your RDS instance

mysql -h your-rds-endpoint -u admin -p

    • Enter the password when prompted.
  • Create the Database and User
    • Run the following SQL commands to create the database and user:

CREATE DATABASE ovaledgedb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE USER 'ovaledge'@'localhost' IDENTIFIED BY '0valEdge!';

CREATE USER 'ovaledge'@'%' IDENTIFIED BY '0valEdge!';

GRANT ALL ON ovaledgedb.* TO 'ovaledge'@'localhost';

GRANT ALL ON ovaledgedb.* TO 'ovaledge'@'%';

  • Verify Database Creation
    • Check if the database was created successfully.

SHOW DATABASES;

  • Restore the Database Dump
    • Select the newly created database:

USE ovaledgedb;

    • Restore the dump file:

mysql -h your-rds-endpoint -u admin -p 

USE ovaledgedb;

source /<db dump path>/ovaledgedb21032025.sql;

  • Verify Data Restoration
    • Check if the tables were restored correctly:

SHOW TABLES;

  • Restart Services
    • Once the changes are saved, restart the services:

sudo docker-compose --env-file mysql.env up -d

    • The -d flag runs the containers in the background.
  • Confirm Elasticsearch Host IP Update
    • Check the logs to verify that the updated Elasticsearch host IP is applied:

sudo docker-compose logs -f

    • This command displays real-time logs of the running containers.