JHipster - 运行liquibase:diff由于“拒绝访问”而失败

时间:2017-01-25 14:56:45

标签: mysql spring-boot liquibase jhipster

在JHipster中向实体添加字段时,最后一步(使用MySQL时)正在运行

  

./ mvnw编译liquibase:diff

根据https://jhipster.github.io/development/

的文档

但是,这对我相当简单的安装不起作用,因为该进程不使用正确的MySQL用户并通过。我的应用程序在开发配置文件中运行良好,但不是这样。

Liquibase从哪里获得证书?

下面你可以看到输出。

[INFO]   artifact: file:/Users/wouter/.m2/repository/org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar
[INFO]   artifact: file:/Users/wouter/.m2/repository/org/springframework/boot/spring-boot-devtools/1.4.2.RELEASE/spring-boot-devtools-1.4.2.RELEASE.jar
[INFO]   artifact: file:/Users/wouter/Business/Workspace/imi-publishing-cloud/target/classes/
[INFO]   artifact: file:/Users/wouter/Business/Workspace/imi-publishing-cloud/target/test-classes/
[INFO] ------------------------------------------------------------------------
[INFO] Settings
----------------------------
[INFO]     driver: com.mysql.jdbc.Driver
[INFO]     url: jdbc:mysql://localhost:3306/imicloud
[INFO]     username: root
[INFO]     password: *****
[INFO]     use empty password: false
[INFO]     properties file: null
[INFO]     properties file will override? false
[INFO]     prompt on non-local database? true
[INFO]     clear checksums? false
[INFO]     changeLogFile: src/main/resources/config/liquibase/master.xml
[INFO]     context(s): null
[INFO]     label(s): null
[INFO]     referenceDriver: null
[INFO]     referenceUrl: hibernate:spring:be.storefront.imicloud.domain?dialect=org.hibernate.dialect.MySQL5InnoDBDialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
[INFO]     referenceUsername: null
[INFO]     referencePassword: null
[INFO]     referenceDefaultSchema: null
[INFO]     diffChangeLogFile: src/main/resources/config/liquibase/changelog/20170125143850_changelog.xml
[INFO] ------------------------------------------------------------------------
Wed Jan 25 15:38:57 CET 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.129 s
[INFO] Finished at: 2017-01-25T15:38:58+01:00
[INFO] Final Memory: 63M/787M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:diff (default-cli) on project imicloud: Error setting up or running Liquibase: liquibase.exception.DatabaseException: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

首先出现使用正确的设置。我的数据库被称为“imicloud”,但后来错误是:

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO) 

显然我使用的是MySQL密码。

如何解决这个问题?

我想我错过了必要的设置步骤,因为这是我第一次使用liquibase:diff命令。

2 个答案:

答案 0 :(得分:11)

mvn liquibase命令使用的凭据可在liquibase插件的配置标记中的pom.xml中找到。 pom.xml的部分如下所示:

        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>${liquibase.version}</version>
            <configuration>
                <changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
                <diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
                <driver>com.mysql.jdbc.Driver</driver>
                <url>jdbc:mysql://localhost:3306/ng2</url>
                <defaultSchemaName>ng2</defaultSchemaName>
                <username>root</username>
                <password></password>
                <referenceUrl>hibernate:spring:com.mycompany.myapp.domain?dialect=org.hibernate.dialect.MySQL5InnoDBDialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
                <verbose>true</verbose>
                <logging>debug</logging>
            </configuration>
            ...

答案 1 :(得分:0)

在src / main / resources / config / application- .yml或应用程序 - .properties文件中相应地配置Spring Boot属性

使用这样的数据库URL添加结尾。

url: jdbc:mysql://localhost:3306/imicloud?u‌​seSSL=false