来自查询的mysqldump [英] mysqldump from a query

查看:73
本文介绍了来自查询的mysqldump的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从查询中为表创建mysql转储?

How can I make a mysql dump for table from a query?

我需要这样的东西.

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

谢谢.

推荐答案

mysqldump具有--where参数:

mysqldump has a --where parameter: Manual

仅转储通过给定WHERE条件选择的行.如果条件包含引号或命令解释器特有的空格或其他字符,则必须在条件周围加上引号.

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.

示例:

-where ="user ='jimf'"

--where="user='jimf'"

-w"userid> 1"

-w"userid>1"

-w用户ID< 1"

-w"userid<1"

我不知道它们的用途,但是 phpMyAdmin 也可以做到这一点,只需进行查询,选择所有行,然后选择底部的导出"按钮即可.

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.

这篇关于来自查询的mysqldump的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆