Skip to content

Instantly share code, notes, and snippets.

View sivasamysubramaniam's full-sized avatar

Sivasamy Subramaniam sivasamysubramaniam

View GitHub Profile
@sivasamysubramaniam
sivasamysubramaniam / rds-init.sh
Created March 31, 2021 04:17 — forked from estahn/rds-init.sh
A workaround to get all data loaded into AWS RDS MySQL. When a read replica is restored from a snapshot, the replica won't wait for all the data to be transferred from Amazon Simple Storage Service (Amazon S3) to the Amazon Elastic Block Store (Amazon EBS) volume that's associated with the replica DB instance. The replica DB instance is availabl…
#!/bin/bash
host=$1
user=$2
password=$3
echo '' > $0.queue
databases=$(mysql -h $host -u $user -p$password -e "show databases" -sN | grep -v information_schema | grep -v mysql | grep -v sys)
for database in $databases; do
for table in $(mysql -h $host -u $user -p"$password" -N -B -e "show tables from \`$database\`"); do