I have a project that uses MySQL database. I want to backup the database every day, so I use this:
mysqldump -h host -u user -p password database > 'location.sql'
I want the files to be named with timestamp, i.e.:
Today the file will be named something-07-05-2014 08-00-00
Tomorrow will be, something-08-05-2014 08-00-00
How to append a formatted timestamp with the exported file name ?
You can use something like this
mysqldump -h host -u user -p password database > $(date "+%b_%d_%Y_%H_%M_%S").sql
you can do
mysqldump -h host -u user -p password database > something-$(date +%d-%m-%Y %H %M %S).sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With