Search

Bash Script for Daily backup of MySQL Database

In what way to plan MySQL database backup. A bash script for MySQL database backup. In this blog, you will discover a modest bash script, which receipts the backup of MySQL database and stock on the local system. This script will also to take away older backups from disk to free space. You can also custom this blog to backup MySQL database and stock a copy on the remote FTP server


Backup Script


Now, copy the subsequent content in a script file (like: /home/ubuntu/daily_backup.sh) and save on your Ubuntu system. Change the variable values in the script as per your requirements.

After producing or downloading script make certain to set execute permission to run correctly.



Schedule Script in Crontab


Now schedule the script in crontab to run daily and whole backup on consistent basis. Edit crontab on your system with crontab -e command. Add subsequent settings to enable backup at 9pm in the night.



Save your crontab file. After allowing cron, the script will take backup routinely, But keep check backups on a weekly or monthly basis to make sure.

13 views0 comments

Recent Posts

See All

What are the future prospects of Java

According to a survey conducted, nearly 63% programmers mentioned that they will likely continue to work with Java along with coding with Python, SQL and HTML/CSS. In addition, the giants in the corpo

Deleting Duplicate Rows in MySQL

In this blog, you will study several ways to delete duplicate rows in MySQL. In this blog, I have shown you how to find duplicate values in a table. Once the duplicates rows are recognized, you may ne

Upload Data to MySQL tables using mysqlimport

Uploading quite a lot of rows of data from a text, csv, and excel file into a MySQL table is a repetitive task for sysadmins and DBAs who are handling MySQL database. This blog clarifies 4 applied exa