iazaran
iazaran

Reputation: 216

mysqldump creates 0 byte sql file from Cron Jobs in cPanel

I have zero bytes sql file (or gz) from this Cron Jobs command in cPanel (only cPanel Cron Jobs):

/usr/local/mysql/bin/mysqldump --user=USERNAME --password=PASSWORD --host=localhost DATABASENAME > /PATH/FILENAME.sql

Many questions checked but nothing found! I check these path for mysqldump:

/usr/mysql/bin/mysqldump
usr/bin/mysqldump
mysqldump

UPDATE: Make .sh file and run that from Cron Jobs. Everythings OK.

#!/bin/bash\
/usr/bin/mysqldump --user=USERNAME --password=PASSWORD --host=localhost DBNAME > /home/CPANELUSER/public_html/FOLDER/FILENAME.sql

Upvotes: 2

Views: 2910

Answers (2)

hassan b.
hassan b.

Reputation: 19

This works for me in BlueHost cPanel: /usr/bin/mysqldump -uUSERNAME -p'PASSWORD' DBNAME > /home4/CPANELUSER/FILENAME_date +\%Y\%m\%d\%H\%M.sql

You can check error by adding this at the end (logs is name of an existing folder):

logs/$(date +"\%Y-\%m-\%d_\%H:\%M").log 2>&1

Upvotes: 1

iazaran
iazaran

Reputation: 216

Make .sh file and run that from Cron Jobs. Everythings OK.

#!/bin/bash\
/usr/bin/mysqldump --user=USERNAME --password=PASSWORD --host=localhost DBNAME > /home/CPANELUSER/public_html/FOLDER/FILENAME.sql

Upvotes: 1

Related Questions