Skip to content

Instantly share code, notes, and snippets.

@sdogruyol
Created September 2, 2013 18:35
Show Gist options
  • Save sdogruyol/6415891 to your computer and use it in GitHub Desktop.
Save sdogruyol/6415891 to your computer and use it in GitHub Desktop.
Simple Bash script to backup your MySQL database. Don't forget it to make it executable by using chmod +x.
#!/bin/bash
now=$(date +"%d_%m_%Y")
password="yourpassword"
db_name="yourdbname"
file_name="db_dump_$now.sql"
echo "Backing up the db to $file_name"
mysqldump -u root -p"$password" "$db_name" > "$file_name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment