简体   繁体   中英

mysqldump table selected row cron job

I am using cron job to dump a table in my database. This code works fine and dumps me a sql file.

mysqldump pabu1v2_pabu tbl_students > /home/pabu1v2/autobackup/backups1.sql

I don't know how to dump only specific rows from this table. But do I wrote this

mysqldump pabu1v2_pabu tbl_students where="schoolid = '113'" > /home/pabu1v2/autobackup/backups1.sql

It gives me a blank sql.

Please, help. I am writing this directly in cron jobs not in php.

Try:

$ mysqldump pabu1v2_pabu tbl_students --where="schoolid = 113" > /home/pabu1v2/autobackup/backups1.sql

See 5.5.4 mysqldump — A Database Backup Program :: where .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM