找不到处理jdbc的数据库:mysql://localhost:3306/

问题描述 投票:0回答:1

我在执行

mvn flyway:migrate
命令时遇到问题。我不断收到似乎与定位我的数据库有关的问题。


        <build>
            <plugins>
                <plugin>
                    <groupId>org.flywaydb</groupId>
                    <artifactId>flyway-maven-plugin</artifactId>
                    <version>9.22.3</version>
                    <configuration>
                        <url>jdbc:mysql://localhost:3306/fooddeliverydb</url>
                        <user>root</user>
                        <password>password</password>
                    </configuration>
                </plugin>
            </plugins>
        </build>

        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.flywaydb/flyway-maven-plugin -->
            <dependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-maven-plugin</artifactId>
                <version>10.0.0</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>8.0.33</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j -->
            <dependency>
                <groupId>com.mysql</groupId>
                <artifactId>mysql-connector-j</artifactId>
                <version>8.2.0</version>
            </dependency>
    
        </dependencies>
    </project>

通过使用 Flyway 插件,我想将 SQL 脚本迁移到我的数据库中。但每次我尝试修复某些问题时,我都会遇到相同的错误。

"
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  0.623 s
    [INFO] Finished at: 2023-11-05T18:17:11+01:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:9.22.3:migrate (default-cli) on project FoodDelivery: org.flywaydb.core.api.FlywayException: No database found to handle jdbc:mysql://localhost:3306/fooddeliverydb -> [Help 1]
"

Mysql

项目结构

java maven mysql-connector flyway
1个回答
0
投票

根据您的

pom.xml
,您似乎缺少对
flyway-mysql
的依赖。 使用 MySQL 的文档中有一个 Java 使用部分,其中应该涵盖您需要包含的内容

© www.soinside.com 2019 - 2024. All rights reserved.