Search code examples
mysqlcroncpanel

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

Solution

  • 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