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

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

WBOY
Release: 2016-06-01 13:08:04
Original
999 people have browsed it

mysqldump

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

-w, --where=nameDump only selected records. Quotes are mandatory
Copy after login

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

mysqldump --single-transaction -w ' id  mydump.sql
Copy after login
Copy after login

这时候就可以备份出mytable表中 id

mysqldump --single-transaction -w " id  mydump.sql
Copy after login

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

mysqldump --single-transaction -w ' id  mydump.sql
Copy after login
Copy after login

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

WHERE id <p>眼尖的同学会发现,时间条件变成了:</p><pre class="brush:php;toolbar:false">WHERE id <p>也就是变成了:</p><pre class="brush:php;toolbar:false">unix_timestamp(2007)
Copy after login

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

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