먼저 진행되고 있던 프로젝트에 합류하고, swagger 문서를 확인하기 위해 스프링을 구동하자 다음과 같이 에러가 생겼다.
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
확인해보니 db가 실행되지 않아서였다. 현 프로젝트에서 mysql을 사용하는데, mysql을 지워놨기 때문에 다시 설치부터 하기로 했다.
Homebrew를 이용해 설치해줬다. 설치 순서는 다음과 같다.
brew update
brew install mysql
‼️ 나는 여기서 마지막에 다음과 같은 에러가 떴다.
Error: Cannot install mariadb because conflicting formulae are installed.
mysql: because mariadb, mysql, and percona install the same binaries
Pleasebrew unlink mysql
before continuing.
Unlinking removes a formula's symlinks from /usr/local. You can
link the formula again after the install finishes. You can--force
this
install, but the build may fail or cause obscure side effects in the
resulting software.
mariadb 관련 문제가 생겼다. 일단 넘어갔지만 아래에서 해결한다.
mysql --version
brew services start mysql
mysql_secure_installation
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
mysql -u root -p
mysql> create database [db 이름: realTimeStream];
mysql> show databases;
spring:
datasource:
url: jdbc:mysql://localhost:3306/realTimeStream
username: root
password: (비밀번호)
driver-class-name: com.mysql.cj.jdbc.Driver