We assume that you have had MySQL shell or config MySQL command on your terminal.
In this part, we create backup.sql
storing data of the on-premise database and import them into the RDS database.
Open your terminal in the folder in which your backup file will be stored.
Enter this command:
mysqldump -u username -p database_name > backup.sql
Now you will open your MobaXterm:
Create connection by MobaXterm
ec2-user
Upload the backup.sql file into EC2
Now, we will connect to RDS database through EC2 instance:
Install the mysql command-line client from MariaDB.
sudo dnf update -y
sudo dnf install mariadb105
The -y option installs the updates without asking for confirmation. To examine updates before installing, omit this option.
Enter this command to check:
mysql —version
Connect to the RDS DB instance. Enter the following command. This action lets you connect to the RDS DB instance using the MySQL client.
Substitute the DB instance endpoint (DNS name) for endpoint, and substitute the master username. Provide the master password that you used when prompted for a password.
run command:
mysql -h endpoint -P 3306 -u username -p
After connecting to RDS database, we execute these command step by step to import our backup data:
mysql> create database bistro;
mysql> use bistro;
mysql> source backup.sql;
You will see all executing query.