본문 바로가기

Dev.BackEnd/Spring & Spring Boot

[springboot,mysql] mysql 5.xx버전에서 8.xx버전으로 바꿔 driver가 spring에 붙지 않을 때

 

로컬에서 mysql5.7버전을 사용하다, 개발서버에 mysql 8.0버전을 설치하여 개발서버의 mysql에 접근을 하려했다.

 

2023-11-07 09:36:54 [ERROR] [http-nio-8080-exec-1] [o.s.s.w.a.UsernamePasswordAuthenticationFilter] - An internal error occurred while trying to authenticate the user.
org.springframework.security.authentication.InternalAuthenticationServiceException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is cohttp://m.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

 

 

하지만 이렇게 에러가 나왔고, 핵심은 DB연결이 안되었다는 것이다.

pom.xml에 가본다

 

 

버전이 5버전이다.

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.39</version>
        </dependency>

 

버전이 8버전으로 변경하였다.

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.33</version>
        </dependency>