只转储某些行

我正在尝试对数据库中的几行执行 mysql 转储。然后,我可以使用转储将这几行上传到另一个数据库中。我的代码正常工作,但它转储了所有东西。如何让 mysqldump 只转储表的某些行?

这是我的代码:


mysqldump --opt --user=username --password=password lmhprogram myResumes  --where=date_pulled='2011-05-23' > test.sql


77851 次浏览

Just fix your --where option. It should be a valid SQL WHERE clause, like:

--where="date_pulled='2011-05-23'"

You have the column name outside of the quotes.

You need to quote the "where" clause.

Try

mysqldump --opt --user=username --password=password lmhprogram myResumes  --where="date_pulled='2011-05-23'" > test.sql

Use this code for specific table rows, using LIKE condition.

mysqldump -u root -p sel_db_server case_today --where="date_created LIKE '%2018
%'" > few_rows_dump.sql