Skip to content

Instantly share code, notes, and snippets.

@ashokarun
Created October 1, 2017 16:37
Show Gist options
  • Save ashokarun/7a5f697d3f71f243372b6526fccc810a to your computer and use it in GitHub Desktop.
Save ashokarun/7a5f697d3f71f243372b6526fccc810a to your computer and use it in GitHub Desktop.
To backup all the databases in the server as separate individual sql files
#!/bin/bash
#Author : Arunlal A
#Website: https://www.crybit.com
echo "Staring database backup process..."
for db in `echo 'show databases;' |mysql |grep -Ev "Database|information_schema|performance_schema"`; do mysqldump $db | gzip > /backup/$db.sql.gz ;done
echo "Done! Check /backup/ directory for your SQL files."
@ashokarun
Copy link
Author

ashokarun commented Oct 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment