Database
Docker로 MySQL 설치하기
Code Gear - 유튜브 개발 강의 블로그
2022. 1. 15. 15:14
반응형
이 글의 동영상 강의입니다.
우선 아래 사이트에 가서 Docker를 설치합니다.
https://www.docker.com/get-started
Get Started with Docker | Docker
Learn about the complete container solution provided by Docker. Find information for developers, IT operations, and business executives.
www.docker.com
다음은 프로젝트 루트 폴더에 다음과 같이 docker-compose.yml을 생성합니다.
version: '3'
services:
local-db:
image: library/mysql:5.7
container_name: local-db
restart: always
ports:
- 13306:3306
environment:
MYSQL_ROOT_PASSWORD: root
TZ: Asia/Seoul
volumes:
- ./db/mysql/data:/var/lib/mysql
- ./db/mysql/init:/docker-entrypoint-initdb.d
platform: linux/x86_64
아래 스크립트를 실행합니다.
docker-compose up -d
설치가 완료되면 Docker Dashboard에 아래와 같이 mysql 이 추가됩니다.
우측의 start 버튼을 클릭하여 서버를 실행합니다.
MySQL Workbench를 이용해서 db에 접속합니다.
접속 정보는 다음과 같습니다.
이후로는 MySQL Schema와 사용자를 생성하시면 됩니다.
반응형