favorites-web icon indicating copy to clipboard operation
favorites-web copied to clipboard

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

Open LukeLIN-web opened this issue 2 years ago • 1 comments

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 avatar Feb 22 '22 14:02 LukeLIN-web

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

LukeLIN-web avatar Feb 22 '22 14:02 LukeLIN-web