-
Docker DB 컨테이너 생성 및 인텔리제이로 DB 접속STUDY/ETC 2022. 5. 28. 23:27
Docker로 MySQL 컨테이너를 띄워보고 인털리제이에서 해당 DB를 접속해보겠다.
1. Docker MySQL Container 생성
https://hub.docker.com/_/mysql
Mysql - Official Image | Docker Hub
We and third parties use cookies or similar technologies ("Cookies") as described below to collect and process personal data, such as your IP address or browser information. You can learn more about how this site uses Cookies by reading our privacy policy
hub.docker.com
처음에는 아래와 같은 오류가 계속 나서 스택오플로우에서 찾아봤더니 --platfrom linux/x86_64/v8을 추가하라는 것을 발견해서 추가했더니 실행이 되었다.
docker: no matching manifest for linux/arm64/v8 in the manifest list entries.
docker run --name springboot-mysql -e MYSQL_ROOT_PASSWORD=pass -d --platform linux/x86_64/v8 mysql
docker ps 를 해보면 아래와 같이 띄워져있음을 확인할 수 있다.
2. 컨테이너 접속
아래 명령어로 컨테이너에 접속 후 (컨테이너이름 입력)
docker exec -it springboot-mysql /bin/bash
mysql 데이터베이스에 root 권한으로 접속
mysql -u root -p
DB생성
create database springbatch;
3. 인텔리제이 접속
오른쪽에 Database 클릭 후
mysql 선택
name, password, database 입력 후 Test Connection 하면 정상적으로 연결된 것 확인할 수 있다.
스키마 눌러보면 default schema로 체크 되어 있는 것 까지 확인 할 수 있다.
'STUDY > ETC' 카테고리의 다른 글
[AWS] AWS Free tier 인스턴스 삭제하기 (0) 2023.02.19 [etc] Mac M1 iTerm2 & homebrew & oh-my-zsh 설치 (0) 2022.03.16 [AWS] AWS Free tier 계정 생성 및 인스턴스 생성하기 (0) 2022.03.15 [GIT] Support for password authentication was removed on... (0) 2021.08.14 [GIT] MAC 업데이트 후 git error (xcrun: error: ... ) (0) 2021.02.11