我目前正在使用 phpmyadmin 导出作为 sql 转储手动进行数据库备份,结果文件名将是 spbkYYMMDD(Y;year m:month D:day).有什么方法可以自动化数据库备份,以便我获得 sql定期转储,文件名应该会自动生成相应的.你能解释一下逻辑吗.
I am currently taking database backup manually using phpmyadmin export as a sql dump,the resulted file name will be spbkYYMMDD(Y;year m:month D:day).Is there any way to automate db backup so that i get sql dump for regular intervals and the file name should automatically generated correspondingly .can you explain me the logic.
在 unix shell 中运行 crontab 并创建规则以启动创建数据库备份的过程
Run crontab in unix shell and create the rule to launch process for creating database backup
0 0 * * * /usr/local/bin/mysqldump -uLOGIN -PPORT -hHOST -pPASS DBNAME | gzip -c > `date "+\%Y-\%m-\%d"`.gz
还要检查这个
编辑
Web 界面你只需要编写,不要认为你可以找到一个现成的代码.但是您需要使用 cron 作业来自动执行在 unix 机器上定期运行的功能.您可以在此处找到有关如何编写 cron-job 的更多信息.所以你现在只需要写一个web界面,它从用户那里获取数据并根据输入改变规则(我认为你可以自己做)
The web interface you only have to write, dont think you can find a readymade code for that. But You need to use cron job, to automate a function to run at regular intervals in a unix machine. You can find more info on how to write a cron-job here. So you now, just need to write a web interface, which gets data from user and changes the rule according to the input(Which I think you can do it yourselves)
这篇关于如何使用 phpmyadmin 自动备份数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!