日常

ケ・セラ・セラ

MySQL 条件に一致する一部のデータのみダンプしたいとき

このようにする。

mysqldump -uroot database_name table_name -t -w "id = '1111' and name = 'foo' and created_at < '2015-08-01'" > dump_file

--where='where_condition', -w 'where_condition' のように条件を指定できる。

create table statement がいらない時は --no-create-info, -t すればよい。