Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Declare variables
- $db = "[DB NAME]"
- $user = "[DB USERNAME]"
- $pw = "[DB PASSWORD]"
- $date = (Get-Date).ToString("yyyy-MM-dd_HH.mm.ss")
- $mysql_backupfile = ".backup_$date.sql"
- $zipped_backupfile = "$mysql_backupfile.zip"
- # Backup MySql database
- mysqldump --user=$user --password=$pw --databases $db > $mysql_backupfile
- # Compress file using 7zip
- sz a -tzip $zipped_backupfile $mysql_backupfile
- # Remove uncompressed backup file
- rm -Path $mysql_backupfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement