Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
rsmarsha
Forum Contributor
Posts: 242 Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England
Post
by rsmarsha » Thu Mar 17, 2005 5:18 am
I have been told i can set cron jobs on my host using SSH, but i've no idea how to do this. I need to find some way of backing up a MySQL database automatically.
Any ideas?
rsmarsha
Forum Contributor
Posts: 242 Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England
Post
by rsmarsha » Thu Mar 17, 2005 6:08 am
I have downloaded putty and logged into my server via SSH, but i can't connect to the db itself. My db is not localhost so not sure how to connect to it.
timvw
DevNet Master
Posts: 4897 Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium
Post
by timvw » Thu Mar 17, 2005 11:18 am
it's clearly explained in the mysql manual. -hhhhhhhhhhhhh host / mysqldump
rsmarsha
Forum Contributor
Posts: 242 Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England
Post
by rsmarsha » Fri Mar 18, 2005 3:13 am
Yeah managed it now.
One thing though, do i need a new cron tab for each job? Or is leaving a blank line below each one ok?
rsmarsha
Forum Contributor
Posts: 242 Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England
Post
by rsmarsha » Sat Mar 19, 2005 11:18 am
Also my crontab doesn't seem to overwrite the existing file each time. Do i need to specify something to make it overwrite the previous days backup?
Do i need to make it remove the file first? Or is there a way to make it dump the file with the days date as part of the name?
timvw
DevNet Master
Posts: 4897 Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium
Post
by timvw » Sat Mar 19, 2005 5:16 pm
how hard can it be to do a websearch on "mysql backup"?
usually, in your script you use the date program so you can append it to your file.
on the other hand, you could tar|gz the backup and/or make incremental backups during weekdays.. and start a new full backup every sunday...
just choose what you like most