Skip to content

Instantly share code, notes, and snippets.

@gggauravgandhi
Last active August 29, 2016 06:33
Show Gist options
  • Save gggauravgandhi/dd66aa0004016f206371480ef60fb20b to your computer and use it in GitHub Desktop.
Save gggauravgandhi/dd66aa0004016f206371480ef60fb20b to your computer and use it in GitHub Desktop.
Generate sql dump file.
#!/bin/bash
printf "Enter host name : "
read host_name
printf "Enter database name : "
read db_name
printf "Enter username name : "
read username
filename='db_backup.sql.gz'
mysqldump -h $host_name -u $db_name -p $db_name | gzip > $filename
echo "Your file is ready at: $filename"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment