如何使用phpmyadmin自动执行数据库备份(How to automate database backup using phpmyadmin)

846 IT屋

我目前正在使用phpmyadmin export作为sql dump手动进行数据库备份,结果文件名为spbkYYMMDD(Y; year m:month D:day).是否有任何方法可以自动执行db备份以获取sql定期进行转储,文件名应自动相应地生成.您能向我解释一下逻辑吗?

解决方案

在UNIX shell中运行crontab并创建规则以启动创建数据库备份的过程

 0 0 * * * /usr/local/bin/mysqldump -uLOGIN -PPORT -hHOST -pPASS DBNAME | gzip -c > `date "+\%Y-\%m-\%d"`.gz

还要检查

编辑

您只需要编写Web界面,不要以为可以找到现成的代码.但是您需要使用cron作业,以使功能自动运行以在UNIX机器中定期运行.您可以在此处找到有关如何编写cron作业的更多信息.所以现在,您只需要编写一个Web界面即可从用户那里获取数据并根据输入更改规则(我想您可以自己做到)

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.

解决方案

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

Also check this

EDIT

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)

本文地址:IT屋 » 如何使用phpmyadmin自动执行数据库备份

相关文章: