Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liquibase Windows MySQL - Cannot find database driver: com.mysql.cj.jdbc.Driver

I am running the following command in Powershell with a view to get it on CircleCI but am seeing the error: Cannot find database driver: com.mysql.cj.jdbc.Driver

./liquibase.bat --driver=com.mysql.cj.jdbc.Driver --classpath=E:\Software\liquibase-3.10.2\lib\mysql-connector-java-5.1.48.jar --url="jdbc:mysql://REDACTED:3306/sandbox" --changeLogFile=/db.changelog-1.0.mysql.sql --username=REDACTED --password=REDACTED ` generateChangeLog

I have checked the classpath of the mysql-connector file being correct / ran a file exists and is True

[System.IO.File]::Exists('E:\Software\liquibase-3.10.2\lib\mysql-connector-java-5.1.48.jar')

The PATH variable has the Liquibase root folder after checking the output of

$env:PATH

Any pointers would be greatly appreciated

Thanks

like image 804
Rob C Avatar asked Oct 21 '25 13:10

Rob C


2 Answers

Change your driver to

--driver=com.mysql.jdbc.Driver

or update your mysql dependency. I believe your dependency has package com.mysql.jdbc but mysql updated their library with new package.

Try to use this one for example.

like image 150
bilak Avatar answered Oct 23 '25 03:10

bilak


For me, it worked when I added mysql dependency for the plugin:

        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>4.15.0</version>
            <configuration>
                <propertyFile>${liquibase.properties}</propertyFile>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>8.0.26</version>
                </dependency>
            </dependencies>
        </plugin>
like image 34
Rogol Avatar answered Oct 23 '25 04:10

Rogol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!