본문 바로가기

업무_메모

[MySQL] 백업 -> 복구, 도커에 설치

1. 도커 설치

 : https://www.docker.com

 

Docker: Accelerated Container Application Development

Docker is a platform designed to help developers build, share, and run container applications. We handle the tedious setup, so you can focus on the code.

www.docker.com

 

2. HeidiSQL 이용하여 백업하기
 : 우클릭 > 데이터베이스를 SQL로 내보내기 선택 > 데이터 선택, 파일명을 통해 위치와 이름 설정 > 내보내기 클릭

 

3. 도커 버전 확인

docker -v

+ 윈도우에서 도커(Docker)를 사용할 때 'Docker Desktop requires a newer WSL kernel version.'가 나타나면 조치 방법

wsl --update

 

4. 도커에 mysql 설치

docker pull mysql


5. 백업한 파일을 내가 만든 도커 mysql에 전송

docker cp C:\Users\binna\Desktop\dump.sql 도커이름:/home

▼ 아래의 이미지는 도커 이름 확인하는 방법

 

6. Open in terminal 에서 백업 파일 잘 받았는지 확인 후 아래와 같이 복원하기

mysql -u root -p < dump.sql

▼ 아래의 이미지는 도커에 설치한 mysql 터미널 열기

 

** 작업시 참고한 블로그

https://poiemaweb.com/docker-mysql

 

Docker를 사용하여 MySQL 설치하고 접속하기 | PoiemaWeb

 

poiemaweb.com

https://engineeringcode.tistory.com/662

 

윈도우에서 도커(Docker)를 사용할 때 'Docker Desktop requires a newer WSL kernel version.'가 나타나면 조치 방

도커(Docker)를 윈도우에서 사용할 때 'Docker Desktop requires a newer WSL kernel version.'라는 메시지와 함께 실행되지 않으면 아래의 명령어를 파워쉘(PowerShell)에 입력하여 해결할 수 있다. 아래의 명령어를

engineeringcode.tistory.com

https://cheershennah.tistory.com/173

 

[DBMS] MySQL dump / import. 디비 덤프 및 임포트 하기

MySQL dump / import. 디비 덤프 및 임포트 하기 1. Dump - 전체 스키마 dump $> mysqldump -u[사용자아이디] -p[패스워드] 데이터베이스명 > 경로 및 저장될 파일명.sql // ex) mysqldump -uroot -p1234 testdb > /root/backup/tes

cheershennah.tistory.com