I have a jhipster generated database, where I am trying to run this command:
mvn liquibase:diff
But right now I am getting the following error:
Failed to execute goal org.liquibase:liquibase-maven-plugin:4.6.1:diff (default-cli) on project product:
Error setting up or running Liquibase:
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to hibernate:spring:com.moniesta.product.domain?dialect=&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy with driver com.mysql.jdbc.Driver. Possibly the wrong driver for the given database URL
My database is running in docker and is configured like this in its docker-compose:
products-mysql:
image: mysql:8.0.28
platform: linux/x86_64
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_DATABASE=products
command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp
ports:
- '3306:3306'
This is how my pom is configured for the liquibase command:
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/config/liquibase/master.xml</changeLogFile>
<diffChangeLogFile>${project.basedir}/src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/product?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true</url>
<username>root</username>
<emptyPassword>true</emptyPassword>
<referenceDriver>com.mysql.jdbc.Driver</referenceDriver>
<contexts>local</contexts>
<referenceUrl>hibernate:spring:com.moniesta.product.domain?dialect=&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
<verbose>true</verbose>
<logging>error</logging>
<contexts>!test</contexts>
</configuration>
I see it tries to connect to the database correctly but the driver fails, but this is a mysql database so should the driver be not mysql.jdbc? I am using mysql8