Cant Create MysqlDump


#1

cd /var/lib/docker/volumes/easyengineio_htdocs/_data/htdocs
mysqldump easyengine_io > enginedump.sql

it says "Unknown database when selecting database


#2

This will dump all site DBs into individual .sql files, into /var/Backups (*which should already exist):

USER="root"
PASSWORD=`cat /opt/easyengine/services/docker-compose.yml | grep MYSQL_ROOT_PASSWORD | awk -F'=' '{print $2}'`
OUTPUT="/var/Backups"
DOCKERDatabaseID=`docker ps | grep -e 'services_global-db' | cut -c1-12;`

databases=`docker exec $DOCKERDatabaseID bash -c "mysql -h localhost --user=$USER --password=$PASSWORD -e 'show databases;'" | tr -d "| " | grep -v Database`

for db in $databases; do
    if [ "$db" != "information_schema" ] && [ "$db" != "performance_schema" ] &&
 [ "$db" != "mysql" ] && [ "$db" != _* ] ;
then
#       Uncomment this line if you want to see the DB being exported
#        echo "Dumping database: $db"
        sudo docker exec $DOCKERDatabaseID bash -c "/usr/bin/mysqldump -u $USER -p$PASSWORD --databases $db" > $OUTPUT/$db.sql
    fi
done