인텔리제이 자바 설정
인텔리제이는 프로젝트마다 자바 버전을 다르게 설정 할 수 있으니
git에서 clone하고 yml파일 확인해서 알맞은 버전을 사용해야 한다
참고 : https://hello-judy-world.tistory.com/175
인텔리제이에서 DB바로 확인하기
CTRL + SHIFT + F10 -> DB콘솔창 띄우기 가능하다
도커에서 데이터베이스 만들기
Docker desktop 실행중이어야 DB에 접속 가능하
항상 로컬에서만 DB를 만들었는데 이번에는 도커에서 만드는걸 배웠다
mysql 이미지 다운
docker pull mysql
다운 받은 이미지를 확인
docker images
Mysql 설정
커맨드에서 컨테이너 이름, 비밀번호를 설정함과 동시에 컨테이너 실행을 합니다. --name 뒤에는 컨테이너 이름을 작성하고, MYSQL_ROOT_PASSWORD에는 mysql에서 사용할 비밀번호를 입력하면 됩니다. -p 3306:3306은 컨테이너 외부포트와 내부에서 사용할 포트를 지정합니다.
mysql 설정과 동시에 컨테이너 실행
docker run --name my-db -e MYSQL_ROOT_PASSWORD=1234 -d -p 3306:3306 mysql
mysql 컨테이너 접속
docker exec -it my-db bash
mysql 서버에 접속
mysql -u root -p
비밀번호 요구하면 :1234
데이터베이스 생성
create database apptive;
생성된 데이터베이스 확인
show databases;
데이터 베이스 사용
use apptive;
이렇게 생성한 DB를 heidiSQL을 사용해서 연결시킬 수 있다
새 연결 추가:
HeidiSQL을 실행한 후에는 "새 연결" 버튼을 클릭하여 새로운 데이터베이스 연결을 추가합니다.
연결 설정:
연결 설정 창에서 다음과 같이 필요한 정보를 입력합니다.
호스트/IP: localhost 또는 도커가 실행 중인 머신의 IP 주소
사용자 이름: MySQL에 로그인할 사용자 이름
비밀번호: MySQL 사용자의 비밀번호
포트: 도커 컨테이너에서 MySQL이 사용하는 포트 (기본값은 3306)
https://velog.io/@ddeo99/Spring-Boot-MySQL-JPA-%EC%97%B0%EB%8F%99%ED%95%98%EA%B8%B0
스프링 데브 툴 안될때