[MySQL]mysqlbinlog 0 0 4,155

by 김정식 [MySQL 노하우/팁/자료] MySQL mysqlbinlog [2009.02.24 16:13:37]


# mysqlbinlog --help
-?, --help              Display this help and exit
-s, --short-form        Just show the queries, no extra info
-o, --offset=N          Skip the first N entries
-h, --host=server       Get the binlog from server
-P, --port=port         Use port to connect to the remove server
-u, --user=username     Connect to the remove server as username
-p, --password=password Password to connect to remote server
-r, --result-file=file  Direct output to a given file
-j, --position=N        Start reading the binlog at position N
-t, --table=name        Get raw table dump using COM_TABLE_DUMB
-V, --version           Print version and exit.


-- SQL 파일로 변환
mysqlbinlog xxx-bin.000001 > aaa.sql
mysqlbinlog -d database_01 mysql-bin.00001 > restore_00001.sql
mysqlbinlog --start-datetime="2008-12-30 01:00:00" --stop-datetime='2009-01-10 01:00:00' /usr/local/mysql/var/localhost-bin.000001 > bakcup.sql


-- 필요한 부분만 가져옴..
grep "INSERT" aaa.sql > bbb.sql

-- data import
mysql -u 계정아이디 -p 디비명< bbb.sql

댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입