Comments on: An Advance Bash Script for MySQL Database Backup https://tecadmin.net/advance-bash-script-for-mysql-database-backup/ How to guide for System Administrator's and Developers Sat, 04 Jun 2022 12:35:12 +0000 hourly 1 https://wordpress.org/?v=6.1.1 By: Chandrashekhar Sapkal https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-64232 Sat, 04 Jun 2022 12:35:12 +0000 https://tecadmin.net/?p=13273#comment-64232 Hi Rahul I’m using this script working fine but problem is when this script are run twice in days their are only one Latest backup generate on local and s3 we are having old bucket on the local and s3

]]>
By: siswanto https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-62791 Wed, 14 Apr 2021 11:57:14 +0000 https://tecadmin.net/?p=13273#comment-62791 how to backup to google drive? thank

]]>
By: ROGER https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-61490 Thu, 18 Mar 2021 06:54:55 +0000 https://tecadmin.net/?p=13273#comment-61490 Hi, Just tested your script, it is great.

I modified the MYSQL DUMP command to avoid locking the db as the script was making my service unavailable during the backup.

${MYSQLDUMP} –single-transaction –quick –lock-tables=false –opt ${CREDENTIALS} -h ${MYSQL_HOST} -P $MYSQL_PORT $db | ${GZIP} -9 > $FILENAMEPATH

Enjoy

]]>
By: Uzma https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-53120 Sun, 09 Aug 2020 06:54:28 +0000 https://tecadmin.net/?p=13273#comment-53120 Hello,

To accomplish deletion of backup files x number of days I have added following rsync code. Its working fine just 1 issue that it is executing before everything even I have added this code to last in the sh file.
Please guide whats worng or how to set it to run at the end.

###Rsync backup folder #######
[ $VERBOSE -eq 1 ] && echo “Rsync backup folder”
rsync -avuh -e “ssh -p ${SFTP_PORT}” –delete ${LOCAL_BACKUP_DIR}/ ${SFTP_USERNAME}@${SFTP_HOST}:${SFTP_UPLOAD_DIR}
[ $VERBOSE -eq 1 ] && echo “***Rsync completed***”

]]>
By: Uzma https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-53117 Sun, 09 Aug 2020 06:07:50 +0000 https://tecadmin.net/?p=13273#comment-53117 Thanks again Rahul,

I am using this script to transfer backups to backup server. Will this delete backups from remote server after x days? As if not it will full backup server with unnecessary data.

2nd, is it possible that we can automate database import on remote server so backup server always remain updated.

For example, In case main server is down and we want website to shift on backup server. Files are already rsynced and we have database dumps on backup server. So we have to manually import recent database on backup server.
But if there is any script which can automate the import part ( use cron after x hours/days and import most recent dump) it would be great. This might need some additional script on backup server.

]]>
By: Rahul https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-53090 Sat, 08 Aug 2020 09:59:25 +0000 https://tecadmin.net/?p=13273#comment-53090 Hi Uzma, I have updated the backup script to include “.sql” in backup file extension.

]]>
By: Uzma https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-53068 Fri, 07 Aug 2020 12:00:57 +0000 https://tecadmin.net/?p=13273#comment-53068 Hello Rahul,
Thank you for great script. I have few questions.
This script not saving in .sql.gz format. When I unzip compressed file it extract file without .sql extension. How I can change this to store files with .sql.gz extension and extrated files with .sql extension.

]]>
By: Pramod https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-43776 Wed, 20 Nov 2019 07:10:45 +0000 https://tecadmin.net/?p=13273#comment-43776 hi Rahul,

Can you modify code to backup db to azure blob storage

]]>
By: james https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-43359 Wed, 23 Oct 2019 23:57:39 +0000 https://tecadmin.net/?p=13273#comment-43359 Figured it out. Had to do: export S3CMD=/usr/bin/s3cmd

Thanks for the script. works great!

]]>
By: James https://tecadmin.net/advance-bash-script-for-mysql-database-backup/#comment-43356 Wed, 23 Oct 2019 20:05:42 +0000 https://tecadmin.net/?p=13273#comment-43356 Uploading backup file to S3 Bucket
./mysql-dump.sh: line 115: –access_key=***********************: command not found

I am having this error. Not sure how to resolve. I am able to upload to s3 with s3cmd just fine.

]]>