With OS's help this is what we did to backup all our databases.
To backup all of your databases:
Create a file named "dbinfo.txt" with your database names, database usernames, and database passwords like this:
mydb1 mydbuser1 password123
mydb2 mydbuser2 password456
mydb3 mydbuser3 password789
Create a file named "backup_all_dbs.sh":
BACKUPDIR=$(echo ~/backups/mariadb$(date "+%Y%m%d"))
mkdir -p $BACKUPDIR
while read dbinfo; do
password="$DBPASS"" > $BACKUPDIR/$DBNAME.cnf
chmod 600 $BACKUPDIR/$DBNAME.cnf
/bin/mysqldump --defaults-file=$BACKUPDIR/$DBNAME.cnf \
-u $DBUSER $DBNAME \
> $BACKUPDIR/$DBNAME.sql \
Upload "dbinfo.txt" and the script "backup_all_dbs.sh" to your shell user home directory on your Opalstack server.
Connect with SSH to the server.
Run the script like this:
The script will run and backup all of your databases into ~/backups in your shell user home directory.