Computing.Net > Forums > Linux > auto backup mysql database

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

auto backup mysql database

Reply to Message Icon

Name: John
Date: October 9, 2002 at 04:38:45 Pacific
OS: redhat7.3
CPU/Ram: 256mb
Comment:

guru,

I want to my box to auto backup the database what I can do? or how to write the script to have the system auto run the backup command "mysqldupm --opt database > backup.sql"

please help me
thanks
John



Sponsored Link
Ads by Google

Response Number 1
Name: Ghassan Salem
Date: October 9, 2002 at 05:55:48 Pacific
Reply:


hi
I want to know how to backup database in mysql.
I am using Red Hat 7.1 as operating system.

thanx


0

Response Number 2
Name: David Perry
Date: October 9, 2002 at 05:59:26 Pacific
Reply:

#!/bin/ksh
DATE=`date +%Y%m%d`
if [ ! -d /var/dumpfiles ] ; then
mkdir /var/dumpfiles
fi
cd /var/dumpfiles/
find . -type f -mtime +5 -exec rm -f {} \;
mysqldump --opt test \
> /var/dumpfiles/backup$DATE.sql

save the above as /usr/bin/dump.sh
chmod 775 /usr/bin/dump.sh

add an entry to your crontab to execute this script when ever it pleases you. You might choose to include these dump file


0

Response Number 3
Name: John
Date: October 9, 2002 at 08:24:18 Pacific
Reply:

can you show me how to add to crontab... I'm just new to linux

please
thanks
John


0

Response Number 4
Name: David Perry
Date: October 9, 2002 at 10:56:45 Pacific
Reply:

echo "1 1 * * * root /usr/bin/dump.sh" \
>> /etc/crontab

The '/etc/crontab' file is a system level file for recurring jobs. man crontab will tell you more

7 fields
minute
hour
day_of_month
month
day_of_week
user
command

Rather than the above echo statement, you could edit /etc/crontab with your favorite editor

You could also use "crontab -e"


0

Response Number 5
Name: phn737
Date: November 4, 2002 at 17:09:39 Pacific
Reply:

Now that mysql db is backup (using mysqldump.exe win32), can all the db be restore with mysqlimport.exe? Is it necessary to create the db name first in order to use mysqlimport or is there another command to do this?

Thank you


0

Related Posts

See More



Response Number 6
Name: And
Date: November 12, 2002 at 00:20:44 Pacific
Reply:

You can use backupsmanager from indexsoft.com. May be crontab will be add to it...


0
Reply to Message Icon

Linux format disk how to make a screenshot ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: auto backup mysql database

Re-Install mysql database www.computing.net/answers/linux/reinstall-mysql-database/26370.html

MySQL Database Client Access www.computing.net/answers/linux/mysql-database-client-access/26590.html

MySQL database setup help www.computing.net/answers/linux/mysql-database-setup-help/8988.html