如何从查询中为表创建 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/