community icon indicating copy to clipboard operation
community copied to clipboard

mvn flyway:migrate 执行报错

Open onedaywen opened this issue 4 years ago • 3 comments

看readme文档 3. 运行数据库脚本,创建本地数据库

mvn flyway:migrate

如果需要使用 MySQL 数据库,运行脚本前修改两处配置

# src/main/resources/application.properties 
spring.datasource.url=jdbc:h2:~/community
spring.datasource.username=sa
spring.datasource.password=123
# pom.xml
<properties>
    <db.url>jdbc:h2:~/community</db.url>
    <db.user>sa</db.user>
    <db.password>123</db.password>
</properties>

然后我改成了,

src/main/resources/application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/community?useUnicode=true&characterEncoding=utf8 spring.datasource.username=root spring.datasource.password=123456 spring.datasource.driver-class-name=com.mysql.jdbc.Driver

pom.xml

jdbc:mysql://localhost:3306/community?useUnicode=true&characterEncoding=utf8 root 123456 ```

执行

mvn flyway:migrate

报错:

Failed to execute goal org.flywaydb:flyway-maven-plugin:5.2.4:migrate (default-cli) on project community: org.flywaydb.core.internal.exception.FlywaySqlException: 
[ERROR] Unable to obtain connection from database (jdbc:mysql://localhost:3306/community) for user 'root': Communications link failure

在sh窗口,通过 mysql -u root -p 输入123456是可以连接成功的

onedaywen avatar Nov 24 '21 11:11 onedaywen

同问

dialectice avatar Jun 09 '24 02:06 dialectice

您好!我们已经注意到这个问题,正在积极处理中。感谢您的耐心等待!

Hello! We have noticed this issue and are actively working on it. Thank you for your patience!

@dialectice @onedaywen

rabumboagjoeber avatar Nov 05 '25 12:11 rabumboagjoeber

@rabumboagjoeber @dialectice @onedaywen

非常感谢您的参与!您的意见对我们很重要,我们会认真对待。

Thank you very much for your participation! Your feedback is important to us and we will take it seriously.

rabumboagjoeber avatar Nov 05 '25 16:11 rabumboagjoeber