MYSQL Dump only certain rows
I am trying to do a mysql dump of a few rows in my database. I can then use the dump to upload those few rows into another database. The code I have is working, but it dumps everything. How can I get mysqldump to only dump certain rows of a table?
Here is my code:
mysqldump --opt --user=username --password=password lmhprogram myResumes --where=date_pulled='2011-05-23' > test.sql
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