2016-01-26 33 views
0

我是Grails 3.0的新手,我很烦恼连接到MySql数据库。当我运行该项目时,我收到了几个错误。我仍然没有掌握新的.yml文件。Grails 3.0连接数据库

.yml file

enter image description here

我修改YML文件等的上方。然后我像这样改变了build.gradle文件。 (难道Java版本是错的?我该如何检查?)

enter image description here

这是我得到那么错误。我试图改变网址,但似乎没有任何工作。

enter image description here

+0

可能只是第124行中'url:'的一个缩进问题,因为错误状态 - 但是既然你决定了,那些不可测,不可复制的,不可编辑的图像是要走的路,我们将很难再现你的问题。 – cfrick

+0

@cfrick我的这个很长一段时间现在不好改变它 –

回答

-1

也许那样简单包括其上的MySQL所在的端口?这对我有用。

environments: 
    development: 
     dataSource: 
      dbCreate: update 
      url: jdbc:mysql://localhost:3306/testdb?useUnicode=yes&characterEncoding=UTF-8 
      driverClassName: com.mysql.jdbc.Driver 
      dialect: org.hibernate.dialect.MySQLDialect 
      username: root 
      password: somethingsecret 
      properties: 
       maxActive: -1 
       minEvictableIdleTimeMillis: 1800000 
       timeBetweenEvictionRunsMillis: 1800000 
       numTestsPerEvictionRun: 3 
       testOnBorrow: true 
       testWhileIdle: true 
       testOnReturn: true 
       validationQuery: 'select 1' 
+0

如果你使用默认端口(在MySQL/MariaDB的情况下为3306),你可以省略它,因为它是多余的。 –

0

您是否尝试缩进对齐'dbCreate'并删除'url'和':'之间的空格?