Liquibase Windows MySQL – 无法找到数据库驱动程序:com.mysql.cj.jdbc.Driver

huangapple go评论67阅读模式
英文:

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

问题

以下是翻译好的内容:

我正在PowerShell中运行以下命令,以便在CircleCI上执行,但是出现了错误:找不到数据库驱动程序: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

我已经检查了mysql-connector文件的类路径是否正确/运行了一个文件存在性检查,结果为True

在检查了输出之后,PATH变量中包含了Liquibase根文件夹

$env:PATH

如果有任何指导意见,将不胜感激

谢谢

英文:

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

答案1

得分: 6

将您的驱动程序更改为

--driver=com.mysql.jdbc.Driver

或更新您的MySQL依赖项。我相信您的依赖项具有com.mysql.jdbc包,但是MySQL已经更新了他们的库,使用了新的包。

尝试使用这个作为示例。

英文:

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.

答案2

得分: 0

对我而言,在插件中添加了mysql的依赖后,它起作用了:

<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>
英文:

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

        &lt;plugin&gt;
            &lt;groupId&gt;org.liquibase&lt;/groupId&gt;
            &lt;artifactId&gt;liquibase-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;4.15.0&lt;/version&gt;
            &lt;configuration&gt;
                &lt;propertyFile&gt;${liquibase.properties}&lt;/propertyFile&gt;
            &lt;/configuration&gt;
            &lt;dependencies&gt;
                &lt;dependency&gt;
                    &lt;groupId&gt;mysql&lt;/groupId&gt;
                    &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
                    &lt;version&gt;8.0.26&lt;/version&gt;
                &lt;/dependency&gt;
            &lt;/dependencies&gt;
        &lt;/plugin&gt;

huangapple
  • 本文由 发表于 2020年9月10日 21:25:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/63830696.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定