首页 > 解决方案 > Spring boot参数更新模型数据库不起作用

问题描述

我将值设置为更新值,以便在数据库中创建一个表,自动对应于定义的数据模型。但它不起作用,我的属性有什么问题?数据库:Mysql

spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

spring.servlet.multipart.max-file-size=2MB
spring.servlet.multipart.max-request-size=2MB


server.port=8081
server.servlet.session.timeout=1200
spring.datasource.url=jdbc:mysql://localhost:3306/test?useSSL=false&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=UTC
spring.datasource.username= root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update

spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect

spring.jpa.database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.properties.hibernate.storage.storage_engine=innodb

spring.security.user.name="root"
spring.security.user.password="123"
spring.resources.add-mappings=true
java.sql.SQLSyntaxErrorException: Table 'test.files' doesn't exist

与“spring.jpa.hibernate.ddl-auto=update”发生了什么冲突

标签: javaspringspring-boothibernate

解决方案


确保数据库连接字符串有效。尝试改变spring.datasource.url=jdbc:mysql://localhost:3306/test?useSSL=false&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=UTC

您的数据库的名称是“测试”,但它是真的吗?


推荐阅读