728x90
목차
1. 데이터베이스 백업
2. 데이터베이스 복원
3. 데이터베이스 로그

 

1. 데이터베이스 백업

데이터베이스 백업(콘솔창에서)

  • 전체 데이터베이스 백업
  • 특정 데이터베이스 백업
  • 특정 테이블 백업(데이터포함)
  • 스키마만 백업
  • 데이터만 백업

 

데이터베이스 백업(Backup)

  • 데이터베이스 백업(워크벤치에서)
mysqldump -uroot -p —all-database > dump_all.sql
mysqldump -uroot -p —databases world > world.sql
mysqldump -uroot -p world city > city.sql
mysqldump -uroot -p —no-data world country > country_schema.sql
mysqldump -uroot -p —no-create-info world country > country_data.sql

 

2. 데이터베이스 복원

데이터베이스 복원

  • 콘솔(Console)
  • 프롬프트(Prompt)
  • 워크벤치
drop table city;
mysql -uroot -p world city < city.sql
truncate table country;
mysql -uroot -p world country < country_data.sql
drop database world;
mysql -uroot -p world < world.sql

 

3. 데이터베이스 로그

데이터베이스 운영 상황을 별도의 파일에 저장

  • 에러로그(Error Log)
  • 일반로그(General Log)
  • 슬로우 쿼리 로그(Solo Query Log)
  • 이진 로그(Binary Log)/릴레이 로그(Relay Log)
  • my.ini / my.cnf

[mysqld]

# MyISAM 로그

log-ism

# 쿼리 로그

log=c:/mysql/data/mysql.log

# 수정 로그

log-update=c:/mysql/data/mysql-update.log

# 바이너리 로그

log-bin=c:/mysql/data/mysql-bins.log

# 슬로우 쿼리 로그

log-slow-queries=c:/mysql/data/mysql-slow.log

long_query_time=5

728x90

+ Recent posts