来自查询的 mysqldump

标签 mysql mysqldump

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

我需要这样的东西..

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

谢谢。

最佳答案

mysqldump 有一个--where 参数: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"

我不知道他们用什么,但是phpMyAdmin也可以这样做,只需进行查询,选择所有行并选择底部的“导出”按钮即可。

关于来自查询的 mysqldump,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2431912/

相关文章:

mysql - 并且不使用嵌套选择 sql 查询

mysql - 查询响应时间过长

mysql - ExpressionEngine->要备份哪些表?

mysql - 是否可以使用 mysqldump 转储和导入 View ?

mysql - 将字符串拆分为行

mysql - Perl 编译错误 Compilation failed in require at

mysql - LEFT JOIN 很快,但 RIGHT JOIN 很慢,即使两个表上的索引相同

php - Symfony2 : Very Slow Session Handling

mysql - 备份具有大量表(>100,000)的 mysql 数据库

mysql - '未知变量 "character-set-server=utf-8"' mysqldump 错误