Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mysqldump最近的记录_Mysql - Fatal编程技术网

mysqldump最近的记录

mysqldump最近的记录,mysql,Mysql,mysqldump(或其他命令)是否有只转储最近更新的行的选项?我在文件里找不到关于这件事的任何信息。thx.使用“输入输出文件”语法: 然后,如有必要,您可以稍后使用以下方法导入: LOAD DATA INFILE '/tmp/result.txt' INTO table FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' MySQL网站上的文档: 您可以使用--where选项为mysql

mysqldump(或其他命令)是否有只转储最近更新的行的选项?我在文件里找不到关于这件事的任何信息。thx.

使用“输入输出文件”语法:

然后,如有必要,您可以稍后使用以下方法导入:

LOAD DATA INFILE '/tmp/result.txt' INTO table
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
MySQL网站上的文档:


您可以使用--where选项为mysqldump提供where子句。因此,如果表中有一个名为“modified”的列,并且希望在过去2小时内修改所有行,则可以执行以下操作:

mysqldump my_schema my_table --where="modified > now() - interval 2 hour"

从mysqldump主页:

--式中=`where_条件´,-w`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.

       Examples:

           --where="user=´jimf´"
           -w"userid>1"
           -w"userid<1"
仅转储由给定WHERE条件选择的行。如果条件包含空格或其他特殊字符,则条件周围的引号是必需的
命令解释器。
示例:
--其中=“user=`jimf´”
-w“userid>1”

-w“userid为您想要的查询定义一个视图。然后在视图上使用mysqldump。

在您的案例中,最近的定义是什么?您是如何定义最近的?您的模式中是否有一个列作为更新时间?我在每个表中都有一个时间戳列。“最近的”意味着我告诉它是什么…即从时间戳>所在的表中选择*?"
       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"