Koozali.org: home of the SME Server

Daily backup databases

Offline Rien

  • *
  • 216
  • +0/-0
    • http://www.taurix.nl
Daily backup databases
« on: July 31, 2005, 12:39:33 AM »
I want to make a backup of several databases on a daily basis.

I use te command:
Code: [Select]
mysqldump --add-drop-table --databases DB1 DB2 > /backup/directory/backup.sql

Is there a way to insert the date/time in the name of the backup file?
Rien
(The Netherlands)......

ergozd

Daily backup databases
« Reply #1 on: July 31, 2005, 07:47:28 AM »
You could try creating a cron file with
Code: [Select]

#!/bin/sh
date=date -I
mysqldump --add-drop-table --databases DB1 DB2 > /backup/directory/$date-backup.sql

Offline Rien

  • *
  • 216
  • +0/-0
    • http://www.taurix.nl
Daily backup databases
« Reply #2 on: July 31, 2005, 02:25:02 PM »
Thanks, that did the trick.
Do you know how I can remove the "?" at the end of the datestring?
Rien
(The Netherlands)......

ergozd

Daily backup databases
« Reply #3 on: July 31, 2005, 02:52:23 PM »
Hi!

Not really sure with "?" at the end of datestring...

Code: [Select]
[root@XXXXXX]# date -I
2005-07-31


Check your script so you don't have a typo...

Your backup file should have the name
Code: [Select]
2005-07-31-backup.sql

Offline Rien

  • *
  • 216
  • +0/-0
    • http://www.taurix.nl
Daily backup databases
« Reply #4 on: July 31, 2005, 04:05:58 PM »
Hi,

The code:
Code: [Select]
[root@XXXXXX]# date -I
2005-07-31


works fine but when I put that in the script is displays:

Code: [Select]
2005-07-31?-backup.sql

My script is:

Code: [Select]
date=date -I
mysqldump --add-drop-table --databases home fczc4 > /home/e-smith/files/ibays/software/files/backup/$date-backup.sql


Strange isn't it?
Rien
(The Netherlands)......

ergozd

Daily backup databases
« Reply #5 on: July 31, 2005, 04:17:59 PM »
Try this one... You can modify the date format as you wanted by simply modifying parameters for day, month and year

Code: [Select]
#!/bin/bash
DATE=date +%d-%m-%y
mysqldump --add-drop-table DBNAME > backup-$DATE.sql
gzip --best backup-$DATE.sql


Output should be
Code: [Select]
backup-31-07-05.sql.gz

Offline Rien

  • *
  • 216
  • +0/-0
    • http://www.taurix.nl
Daily backup databases
« Reply #6 on: July 31, 2005, 06:46:03 PM »
Hi,

I tried that but I get the same "?" after the date in the filename.
Can it be I have an old version. I use version 2.0.11 (sh-utils) which is part of SME-server 6.0.1-1.
Rien
(The Netherlands)......

ergozd

Daily backup databases
« Reply #7 on: July 31, 2005, 07:55:53 PM »
That was intreseting...  :-?
I have NO idea why you get "?"...

PS: It's not because of sh-utils, I have the same version.

Offline Rien

  • *
  • 216
  • +0/-0
    • http://www.taurix.nl
Daily backup databases
« Reply #8 on: July 31, 2005, 11:20:21 PM »
I tried different options now but without success.
Rien
(The Netherlands)......

cosy

Daily backup databases
« Reply #9 on: September 11, 2005, 09:41:21 AM »
Hi All,

  I want to Backup some of MYSQL DB's in SME 6.X Server. Is their any GUI interface for backup?

Can i connect any windows mysql backup software to backup these db's if so how?

Thanks

Offline Rien

  • *
  • 216
  • +0/-0
    • http://www.taurix.nl
Daily backup databases
« Reply #10 on: September 11, 2005, 10:08:51 AM »
Hi Cosy,

I use "PHPMyAdmin" to make backups. You can select DB's and tables and export them.
Rien
(The Netherlands)......

arthurhanlon

Daily backup databases
« Reply #11 on: September 11, 2005, 01:31:59 PM »
Hi there,

The is a handy web based DB backup utility at http://www.phpmybackuppro.net/. I use this on other servers and it works great. Haven't tried it on SME yet though.

Arthur

cosy

Daily backup databases
« Reply #12 on: September 20, 2005, 06:42:18 AM »
Hi,

 Can you install into SME and tell me the steps pls

arthurhanlon

Daily backup databases
« Reply #13 on: September 20, 2005, 09:31:51 PM »
Hi,

Never installed onto SME before but I'll give it a try and get back to you. Meanwhile, the help file included is pretty straight forward if you wann have a go yourself.

Arthur

duncan

Daily backup databases
« Reply #14 on: September 21, 2005, 09:30:04 AM »
Hi.

It has been mentioned before - automysqlbackup.

Very simple data base backup utility - that works well.