mysql 테이블 단위 백업 복원및 기타 옵션
mysql를 사용해서, 테이블을 백업, 복원방법
백업)
mysqldump -u 아이디 -p 데이타베이스명 테이블명 > 백업파일명.sql (엔터후 비번입력)
복원)
mysql -u 아이디 -p 데이타베이스명 < 백업파일명.sql (엔터후 비번입력)
[출처] mysql 테이블 단위 백업 복원 |작성자 지킴이
다음은 testDB.employees를 /tmp에 employees.txt로 데이터만 저장하도록 함
% mysqldump -u root -p testDB \
--no-create-info \
--tab=/tmp \
--fields-terminated-by=',' \
--lines-terminated-by='\n' employees
Enter password: ********
% cat /tmp/employees.txt
1,홍길동,010-123-1234,길동이 사는 곳,학생
2,아리랑,010-234-1234,아리랑이 사는 곳,학생
3,쓰리랑,010-345-1234,쓰리랑이 사는 곳,학생
-n, --no-create-db 'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will
not be put in the output. The above line will be added
otherwise, if --databases or --all-databases option was
given.}.
-t, --no-create-info
Don't write table creation info.
-d, --no-data No row information.
-N, --no-set-names Deprecated. Use --skip-set-charset instead.
%