cloudfavorites / favorites-web

云收藏 Spring Boot 2.X 开源项目
http://favorites.ren/
4.82k stars 1.74k forks source link

无法打开http://127.0.0.1:8080/ #121

Open LukeLIN-web opened 2 years ago

LukeLIN-web commented 2 years ago

Caused by: org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory

LukeLIN-web commented 2 years ago

application-docker.properties 设置为

spring.datasource.url=jdbc:mysql://mysql:3308/favorites?useUnicode=true&characterEncoding=utf-8
favorites.base.path=http://127.0.0.1:8080/
forgotpassword.url=http://127.0.0.1:8080/newPassword

application-dev.properties 设置为

spring.datasource.url=jdbc:mysql://mysql:3308/favorites?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true
favorites.base.path=http://127.0.0.1:8080/
forgotpassword.url=http://127.0.0.1:8080/newPassword

docker-compose.yml设置为

  mysql:
   build: ./mysql
   environment:
     MYSQL_DATABASE: favorites
     MYSQL_ROOT_PASSWORD: root
     MYSQL_ROOT_HOST: '%'
     TZ: Asia/Shanghai
   ports:
   - "3308:3306"
   volumes:
     - ./mysql_data:/var/lib/mysql
   restart: always