cron job for backup the database in linux/php

后端 未结 5 1794
不知归路
不知归路 2021-02-10 21:58

Am new to linux cron job, i am using mysql DB, my database name finaldb, i want to take this database every one hour,

I have folder called dailbackup, in this i have fol

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-10 22:43

    Untested one liner:

    mysqldump -u*user* -p*password* -P*dbport* -h localhost finaldb > /.../dailbackup/final_db_$(date +%Y-%m-%d_%H_%M).sql
    

    just add it to your cron job or wrap it in a script and you are done

提交回复
热议问题