How to automate database backup using phpmyadmin(如何使用 phpmyadmin 自动备份数据库)
问题描述
我目前正在使用 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 自动备份数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 phpmyadmin 自动备份数据库
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
