Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
mysqldump  --single-transaction --databases db1 --ignore-table=db1.table1  --ignore-table=db1.table2 -h localhost -u root -pmypwd > mydump.sql

특정 조건인 데이타만 덤프

id가 10,000 이상인 데이타만 덤프

Code Block
languagebash
mysqldump  --single-transaction --databases db1 --ignore-table=db1.table1  --ignore-table=db1.table2 -h localhost \
-u root -pmypwd \
--where='id>10000'
> mydump.sql


created_at 컬럼이 어제 이후인 데이타만 덤프

Code Block
languagebash
mysqldump  --single-transaction --databases db1 --ignore-table=db1.table1  --ignore-table=db1.table2 -h localhost \
-u root -pmypwd \
--where='created_at > subdate(current_date, 1)'
> mydump.sql

dump 파일 복구

db2 에 복구

Code Block
mysql -h dbhost2 -u root -pmypwd db2 <  mydump.sql

...