Last active
May 26, 2019 08:51
-
-
Save techbyvideo/fb10f83c1a1bb939adb8be4c8d5281df to your computer and use it in GitHub Desktop.
Revisions
-
techbyvideo revised this gist
Aug 26, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ for SQL in $LISTEBDD do if [ $SQL != "information_schema" ] && [ $SQL != "mysql" ] && [ $SQL != "performance_schema" ] && [ $SQL != "Database" ]; then ## backup database mysqldump -uroot -p'techbyvideo' $SQL > ${SQL}_`date +"%Y-%m-%d"`.sql -
techbyvideo created this gist
Aug 26, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ #!/bin/bash #Backups Folder cd /backups/mysql/ # Get list of databases LISTEBDD=$( echo 'show databases' | mysql -uroot -p'techbyvideo' ) # Save the current date DATE=`date +%y_%m_%d` ##List of databases for SQL in $LISTEBDD do if [ $SQL != "information_schema" ] && [ $SQL != "mysql" ] && [ $SQL != "performance_schema" ]; then ## backup database mysqldump -uroot -p'techbyvideo' $SQL > ${SQL}_`date +"%Y-%m-%d"`.sql ## Compress file tar.bz2 tar jcf ${SQL}_`date +"%Y-%m-%d"`.sql.tar.bz2 ${SQL}_`date +"%Y-%m-%d"`.sql ## delete backups rm ${SQL}_`date +"%Y-%m-%d"`.sql fi done