How to create a mySQL table where part of name is timestamp
Posted on 2011-09-12
Hi Team, I just have a simple requirement for a mysql table that I want to backup regularly from a bash script.
Basically I have a table called "devices".
1. Every week I need to backup this table to something like "devices_backup_12_sep_2011" (i.e. structure Plus all records but the name should include current date when it was backed up)
2. I need to truncate the existing table "device" (i.e. empty out records).
3. Repopulate this table with fresh records...load data infile....which I know how to do.
I just need some help with the bash script to run the sql commands that creates the new table with the current date as part of the name of the table.
Thanks very much.