Home > Database > Mysql Tutorial > body text

[MySQL FAQ]系列 — mysqldump加-w参数备份

WBOY
Release: 2016-06-07 16:42:28
Original
869 people have browsed it

我们在用mysqldump备份数据时,有个选项是 where / -w,可以指定备份条件,这个选项的解释是: -w, --where=name Dump only selected records. Quotes are mandatory 我们可以做个测试,例如: mysqldump --single-transaction -w ' id 10000 ' mydb mytable

我们在用mysqldump备份数据时,有个选项是 –where / -w,可以指定备份条件,这个选项的解释是:

-w, --where=name Dump only selected records. Quotes are mandatory

我们可以做个测试,例如:

mysqldump --single-transaction -w ' id mydump.sql

这时候就可以备份出mytable表中 id mysqldump --single-transaction -w " id mydump.sql

在这里,一定注意单引号和双引号问题,避免出现这种情况:

mysqldump --single-transaction -w ' id mydump.sql

这样的话,结果条件会被解析成:

WHERE id 眼尖的同学会发现,时间条件变成了: WHERE id 也就是变成了: unix_timestamp(2007) -- 2014-6-1 = 2007

这和我们原先的设想大相径庭,因此一定要谨慎。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!