1

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
iazaran
  • 196
  • 1
  • 6
  • 17

2 Answers2

1

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

hassan b.
  • 21
  • 4
0

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
iazaran
  • 196
  • 1
  • 6
  • 17