[SpringBoot] 프로젝트 생성 & MySql 연동

찌니·2023년 11월 6일
0

Spring Boot

목록 보기
2/2
post-thumbnail

1. spring boot 프로젝트 생성

https://start.spring.io/

2. mySql 설치 & 실행


저는 요로코롬 터미널에서 설치했습니당

brew install mysql
mysql --version

버전확인까지 마치면 mysql server를 실행해봅시다

SUCCESS! 가 뜬다면 당신은 성공자

3. mySql 기본 설정

mysql_secure_installation


엄청나게 길어보이지만 y나 n만 쓰면 됩니다
강한 비밀번호.. 약한 비밀번호.. 원격 접속.. 등 생각보다 간단한 설정이라 간단한 마음으로 설정합니다
All done! 이 뜬다면 당신은 또 성공자

4. mySql 접속

mysql -u root -p

5. mySql 상태 확인

status

위 명령어를 통해 접속해보면 요로코롬 정보도 뜹니다

6. 참고

exit -> mysql 종료
mysql.server stop -> mysql server 종료

7. spring-boot project에 mysql 셋팅

dependency도 요로코롬 추가해주고

application.yml 파일도 만들어서 요로코롬 정보를 추가해주면 진짜 끝!

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/example?serverTimezone=UTC&characterEncoding=UTF-8
    username: root
    password: passward

8. 실행


쟈란~! 여기까지 하면 당신은 성공자

profile
찌니's develog

0개의 댓글