views:

395

answers:

1

How do we take a mysql dump for table from a query

I need something like this..

`mysqldump -uroot -pxxxx mydb "select * from table where name='1';" > /tmp/a

Thanks

+5  A: 

mysqldump has a --where parameter: Manual

Dump only rows selected by the given WHERE condition. Quotes around the condition are mandatory if it contains spaces or other characters that are special to your command interpreter.

Examples:

--where="user='jimf'"

-w"userid>1"

-w"userid<1"

I don't know what they use, but phpMyAdmin can do this too, Just make the query, select all rows and choose the "export" button to the bottom.

Pekka
Thanks........................
Hulk