How can i automatically store data from a few tables in a backup and remove the stored data from the drupal tables.

e.g. every month delete all content older then 3 months from drupal database, but first store it on harddisk.

I looked at backup and migrate, but it's not flexible enough, afaik ..

FORGOT to mention i use windows xp (yes, i know.. i have a good reason )

Comments

yangke’s picture

I created a task with windows task manager. That runs a .bat file every month.

The .bat i run:

d:\xampp\mysql\bin\mysqldump -umyusername -pmypassword mydatabase  --result-file="d:\backup\mydatabasebackup.sql"
d:\xampp\mysql\bin\mysql -umyusername -pmypassword  < "d:\backup\query.sql"

and the query.sql file contains code to delete all entries older then 3 months:

USE labview
DELETE *
FROM mytableone
WHERE
time < DATE_SUB(NOW(),INTERVAL 3 MONTH)

The first line seems to work ok (the backupfile is created), but when adding the second line i get errors about the password.
Any pointers here?

yangke’s picture

Anyone can help me here? ...

Error 1064 (42000) at line 1: You have an error in you SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' d' at line 1
yangke’s picture