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":
#!/bin/bash
BACKUPDIR=$(echo ~/backups/mariadb$(date "+%Y%m%d"))
mkdir -p $BACKUPDIR
while read dbinfo; do
db=($dbinfo)
DBNAME=${db[0]}
DBUSER=${db[1]}
DBPASS=${db[2]}
echo "[client]
password="$DBPASS"" > $BACKUPDIR/$DBNAME.cnf
chmod 600 $BACKUPDIR/$DBNAME.cnf
/bin/mysqldump --defaults-file=$BACKUPDIR/$DBNAME.cnf \
-u $DBUSER $DBNAME \
> $BACKUPDIR/$DBNAME.sql \
2>> $BACKUPDIR/$DBNAME.log
done <dbinfo.txt
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:
sh backup_all_dbs.sh
The script will run and backup all of your databases into ~/backups in your shell user home directory.