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

Issue

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

Solution

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.

Answered By – bilak

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published