Why Spring Boot 2.0 application does not run schema.sql?

Check the documents here.

In a JPA-based app, you can choose to let Hibernate create the schema
or use schema.sql, but you cannot do both. Make sure to disable
spring.jpa.hibernate.ddl-auto if you use schema.sql.

You have spring.jpa.hibernate.ddl-auto=create-drop that’s why schema.sql is not executed.
Looks like this is the way Spring Boot works.

Edit

I think that the problem(not really a problem) is that your application points to a mysql instance.

See the current Spring Boot properties:

spring.datasource.initialization-mode=embedded # Initialize the datasource with available DDL and DML scripts.

The default value is embedded – e.g. initialize only if you’re running and embedded database, like H2.

Also see the answer of Stephan here. He said:

Adding spring.datasource.initialization-mode=always to your project is
enough.

So try to set:

spring.datasource.initialization-mode=always

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)