LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Backup software for MySql database (https://www.linuxquestions.org/questions/linux-software-2/backup-software-for-mysql-database-557997/)

blinton25 05-31-2007 08:43 AM

Backup software for MySql database
 
Hello,

I have a MySQL database which needs to be backed up daily. I would like a copy to be placed on a removable drive and another on the file system at a time specified by me.

I used Freshmeat to take a look at what software does this function and got a number of results. I wanted a recommendation based on user experience on what I should select (I use Ubuntu).

Wim Sturkenboom 05-31-2007 12:55 PM

Software? A simple script, started using crontab, would be my approach.


Code:

#!/bin/bash
# save current date (read man date if you want to add time as well)
mytime=`date +%Y%m%d`

#create backup using mysqldump
mysqldump --opt yourdatabasename > /path_to_directory/yourdatabasename.$mytime.sql

# mount your removable disk (read man mount)
mount .....

# copy to removable disk
cp /path_to_directory/yourdatabasename.$mytime.sql /path_to_mountpoint

# unmount removable disk (read man umount)
unmount .....

If the database is big, you might want to (tar and) zip it during the copy (replace the line containing cp by the line below)
Code:

tar -cvf /path_to_mountpoint/dbbackup.$mytime.tar.gz /path_to_directory/yourdatabasename.$mytime.sql
I have not tested it. It should create a database backup (not zipped) including a date in the filename and copy or tar it to a mounted removable disk.

If the database requires a username and password for access, you have to do some reading (man mysqldump; options -u and -p)

FMC 05-31-2007 01:26 PM

Usually I just dump all databases, tar the file and copy it to some place:

to dump:
# mysqldump --all-databases > dump_backup

You can check some mysqldump options on the man page and make your own script to backup, thats not hard to do!

[]īs, FMC!

blinton25 06-01-2007 01:11 AM

Hello,

In the future the process will be maintained by users with limited technical experience, so I wanted to use a GUI driven approach

slimm609 06-01-2007 01:41 AM

phpmyadmin can do it via a web interface.

Wim Sturkenboom 06-01-2007 03:40 AM

Quote:

Originally Posted by blinton25
In the future the process will be maintained by users with limited technical experience, so I wanted to use a GUI driven approach

The process will be automatic, so no GUI required.


All times are GMT -5. The time now is 02:24 AM.