Education*
Devops
Architecture
F/B End
B.Chain
Basic
Others
CLOSE
Search For:
Search
BY TAGS
linux
HTTP
golang
flutter
java
fintech
개발환경
kubernetes
network
Docker
devops
database
tutorial
cli
분산시스템
www
블록체인
AWS
system admin
bigdata
보안
금융
msa
mysql
redis
Linux command
dns
javascript
CICD
VPC
FILESYSTEM
S3
NGINX
TCP/IP
ZOOKEEPER
NOSQL
IAC
CLOUD
TERRAFORM
logging
IT용어
Kafka
docker-compose
Dart
SQL tutorial with MySQL - 백업 및 복구
Recommanded
Free
YOUTUBE Lecture:
<% selectedImage[1] %>
yundream
2023-04-07
2023-03-31
1348
데이터베이스 운영/관리에서 가장 중요한 것은 시스템 오류나 인적오류가 발생했을 때 데이터를 보호하는 것이다. 데이터 보호를 위해 가장 중요한 것은 데이터 백업이다. 이 문서에서는 데이터베이스와 테이블을 백업하고 백업을 이용해서 데이터를 복원하는 방법을 살펴본다. MySQL과 관련된 모든 테스트는 연습용 데이터베이스를 이용해서 직접 실행해 볼 수 있다. [MySQL & SQL 스터디준비](https://www.joinc.co.kr/w/mysql_study_ready) 문서를 참고하여 실습환경을 구축하자. ## MySQL 데이터베이스 백업 **mysqldump** 명령을 실행해서 특정 데이터베이스의 백업 파일을 만들 수 있다. northwind 데이터베이스를 백업해보자. ```shell mysqldump -u root -p northwind -h 172.17.0.2 > northwind_backup.sql ``` **--all-databases** 옵션으로 MySQL 서버에 있는 모든 데이터베이스를 백업할 수 있다. ```shell mysqldump -u root -p --all-databases -h 172.17.0.2 > northwind_backup.sql ``` **--no--data** 옵션을 이용해서 스키마(schema)만 백업 할 수도 있다. ```shell mysqldump -u root --no-data -p northwind -h 172.17.0.2 > northwind_schema.sql ``` ## MySQL 데이터베이스 복구 아래와 같이 백업 파일을 이용해서 데이터베이스를 복구할 수 있다. ```shell mysql -u [user] -p [database_name] -h [host_name] < [filename].sql ``` northwind_backup.sql로 부터 norhwind 데이터베이스를 복구해보자. ```shell mysql -u root -p northwind -h 172.17.0.2 < northwind_backup.sql ``` 복구를 시작하게 되면, 모든 테이블을 drop하기 때문에 주의해서 진행해야 한다. ## 참고 [SQL Study With MySQL](https://www.joinc.co.kr/w/sql_study_with_mysql_index) 에서 MySQL과 관련된 다른 문서들을 읽을 수 있습니다.
Recent Posts
Vertex Gemini 기반 AI 에이전트 개발 06. LLM Native Application 개발
최신 경량 LLM Gemma 3 테스트
MLOps with Joinc - Kubeflow 설치
Vertex Gemini 기반 AI 에이전트 개발 05. 첫 번째 LLM 애플리케이션 개발
LLama-3.2-Vision 테스트
Vertex Gemini 기반 AI 에이전트 개발 04. 프롬프트 엔지니어링
Vertex Gemini 기반 AI 에이전트 개발 03. Vertex AI Gemini 둘러보기
Vertex Gemini 기반 AI 에이전트 개발 02. 생성 AI에 대해서
Vertex Gemini 기반 AI 에이전트 개발 01. 소개
Vertex Gemini 기반 AI 에이전트 개발-소개
Archive Posts
Tags
database
mysql
sql
SQL tutorial with MySQL
Copyrights © -
Joinc
, All Rights Reserved.
Inherited From -
Yundream
Rebranded By -
Joonphil
Recent Posts
Archive Posts
Tags