Site icon Database Tutorials

How To Backup MySQL Databases With mysqldump

Mysql database should be backed up daily or periodically. It is possible to back up regularly with a script that we will create in the operating system for the backup process. We can use the mysqldump tool for backup.

We can create and schedule a shell script like the one below.

Backup All MySQL Databases

Create a script named mysql_backup.sh with the following content. The script will create a backup file for all databases.

Let’s make the script executable.

mysqldump Exclude Database

With the grep -Ev command, we can specify directories that are not associated with the database in the data directory, or databases that we do not want to back up.

Create a Crontab For Backing up Databases Regularly

FAdd the script to crontab to back it up periodically.

Exit mobile version