Home >Database >Mysql Tutorial >[MySQL FAQ]系列 — mysqldump加-w参数备份_MySQL

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

WBOY
WBOYOriginal
2016-06-01 13:08:041002browse

mysqldump

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

-w, --where=nameDump 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 <p>眼尖的同学会发现,时间条件变成了:</p><pre class="brush:php;toolbar:false">WHERE id <p>也就是变成了:</p><pre class="brush:php;toolbar:false">unix_timestamp(2007)

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

Statement:
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