mysqldump在crontab中不工作 [英] mysqldump doesn't work in crontab

查看:449
本文介绍了mysqldump在crontab中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在备份mysql数据库的crontab(ubuntu服务器)中添加一个cronjob。

I'm trying to add a cronjob in the crontab (ubuntu server) that backups the mysql db.

以root身份执行终端中的脚本很好,但插入crontab什么也没有发生。我试图每分钟运行它,但没有文件出现在/ var / db_backups文件夹中。

Executing the script in the terminal as root works well, but inserted in the crontab nothing happens. I've tried to run it each minutes but no files appears in the folder /var/db_backups.

(其他cronjobs工作良好)

(Other cronjobs work well)

这里是cronjob:

Here is the cronjob:


* * * * * mysqldump -u root -pHERE这是我的密码
--all-databases | gzip> / var / db_backups / database_`date +%d%m%y`.sql.gz

* * * * * mysqldump -u root -pHERE THERE IS MY PASSWORD --all-databases | gzip > /var/db_backups/database_`date +%d%m%y`.sql.gz

推荐答案

您需要使用\

mysqldump -u 'username' -p'password' DBNAME > /home/eric/db_backup/liveDB_`date +\%Y\%m\%d_\%H\%M`.sql

这篇关于mysqldump在crontab中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆