Home > Mobile >  Why cron cant dump table from database?
Why cron cant dump table from database?

Time:12-21

I like to make cron that will dump specific table from database for some reason im getting empty file in .gz any ideas why ?

mysqldump -u root -pp;qqee test_db category | gzip >/home/user/BKP-Category/backup_$( date  "\%Y_\%m_\%d" ).sql.gz

im getting this output after execution

    Usage: mysqldump [OPTIONS] database [tables]
    OR     mysqldump [OPTIONS] --databases DB1 [DB2 DB3...]
    OR     mysqldump [OPTIONS] --all-databases
    OR     mysqldump [OPTIONS] --system=[SYSTEMOPTIONS]]
    For more options, use mysqldump --help
    /usr/local/cpanel/bin/jailshell: q: command not found

CodePudding user response:

the problem was password

-pp;qqee

because include special character ;

i should escape this like

-p'p;qqee'

CodePudding user response:

This should work :

mysqldump -u root -p 'p;qqee' test_db category | gzip >/home/user/BKP-Category/backup_$( date  "\%Y_\%m_\%d" ).sql.gz
  • Related