Search code examples
mysqlbackupdump

cron job for backup only selected tables not whole database in mysql


I am using the following cron job for backup my database daily.

    /usr/bin/mysqldump -u UNAME -p PSSW databasename > /home/mysite/stock/backup.sql

But I want to backup only some of the tables not whole database. Is it possible with cron job?


Solution

  • You can just specify the table names along with mysqldump something as

    mysqldump -u uname -pPSSW dbname table1 table2 table3 tableN > backup.sql