如何使用 phpmyadmin 自动进行数据库备份
我目前正在使用 phpmyadmin 导出作为 sql 转储手动进行数据库备份,结果文件名将是 spbkYYMMDD(Y;年 m:月 D:日)。有没有办法自动进行数据库备份,以便我定期获得 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在 unix shell 中运行 crontab 并创建规则来启动创建数据库备份的进程
另请检查 this
编辑
你只需编写的网络界面,不要以为你能找到现成的代码。但是你需要使用 cron 作业来自动执行一个函数,以便在 UNIX 机器上定期运行。您可以在此处找到有关如何编写 cron 作业的更多信息。所以你现在只需要编写一个Web界面,它从用户那里获取数据并根据输入更改规则(我认为你可以自己做)
Run crontab in unix shell and create the rule to launch process for creating database backup
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)
代码将如下所示:
并将其保存为.bat,您可以从任务计划程序运行它
The Code Will be Like This :
and save it as .bat and u can run it from task scheduler
我为这个确切的用例编写了一个快速脚本,因为我无法访问 mysqldump 的控制台,因此自己需要它:
下载: Github:phpmyadmin_sql_backup.py
在您的案例中的用法:
希望它被证明是有用的 其他的。
I wrote a quick script for this exact use-case, since I had no access to the console for
mysqldump
and therefore needed it myself:Downloads: Github: phpmyadmin_sql_backup.py
Usage in your case:
Hopefully it proves to be useful for others.
自动化 MySQL 数据库备份的最佳方法是结合使用一些备份软件和 phpmyadmin 实用程序。第二种方法通常具有无需额外付费的优点和不受控制的安全性的缺点,即使用cron实现一些脚本。
就我个人而言,除了 phpMyAdmin 之外,我更喜欢 Handy Backup。请参阅文章链接作为示例。它不是最热门的备份解决方案,但相对便宜且非常稳定。
The best way to automate MySQL DB backup is to use some backup software in conjunction with phpmyadmin utility. The second way, often having an advantage of no extra payment and a disadvantage of uncontrolled security, is implementing some script with cron.
Personally, I prefer Handy Backup in addition to my phpMyAdmin. See the link to an article as an example. It is not hottest backup solution, but relatively cheap and very stable.
当您具有管理员权限时,在文件夹中创建 .bat 文件。
下面是一个简单的 .bat 文件
Create .bat file in a folder when you have admin rights.
down here is a simple .bat file