I've spent a lot of time searching around for an answer here, but have been unable to find one. What I'm looking to do is to use "mysqldump" to export two specific fields form a certain table, rather than exporting the entire table. This table contains near 20 fields, but I just need two. The command I'm using so far is:
mysqldump -u USERNAME -p DATABASE --tables TABLE --xml > fields.xml
I just need to know now how to fine-tune it so I can specifiy the two tables I need. I plan to use this command to regularly backup this particular part of the database, and I'm unsure if that can be done via another method or not.
Thanks for any help,
AFAIK you can't use mysqldump to export specific columns from a table, either it will dump all the fields or none. Either write a custom script or look for some other software on google.
Thanks for the info. I just figured out an alright solution though. It just makes more sense to run a SQL command with password intact and achieve virtually the same thing:
mysql -u USERNAME --password=PASSWORD --database=DATABASE --execute='SELECT
TABLE LIMIT 0, 10000 ' -X > file.xml
That works fine, so I think I'll stick with it.
Clever solution, well done!
This topic is now archived. It is frozen and cannot be changed in any way.