mysql Why cron cant dump table from database?

umuewwlo  于 2022-12-22  发布在  Mysql
关注(0)|答案(2)|浏览(121)

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
gopyfrb3

gopyfrb31#

the problem was password
-pp;qqee
because include special character ;
i should escape this like
-p'p;qqee'

xmq68pz9

xmq68pz92#

这应该行得通:

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

相关问题