如何将Grails 3.0连接到我的本地Mysql数据库 [英] How to connect Grails 3.0 to my local Mysql database

查看:175
本文介绍了如何将Grails 3.0连接到我的本地Mysql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的与Grails和试图连接我的应用程序到我的本地mysql数据库。因为我使用最新版本的Grails,我真的找不到很多文档帮助我。有没有明确的文件可以指导我在正确的方向?

I'm quite new with Grails and trying to connect my application to my local mysql database. Since I'm working with the latest version of Grails, I couldn't really find a lot of documentation to help me out. Is there any clear documentation which could guide me in the right direction?

(我试过官方文档,但似乎过时了)

(I've tried the official documentation, but it seems to be out of date)

推荐答案

Grails 3中的数据源配置现在也通过 grails-app / conf / application.yml 文件。在默认项目中,它位于文件的最后一部分(从 dataSource:开始)。自2015-08-01起的文档仍然解释了旧的,v2,句法。但对于开发人员来说,这应该被看作是语法的变化(从Groovy DSL到YAML)。例如:

Datasource configuration in Grails 3 now is done also via the grails-app/conf/application.yml file. In a default project it is located in the final section of the file (starting with dataSource:). The docs as of 2015-08-01 still explain the old, v2, syntax. But for the developer this should be seen just as a change in syntax (from a Groovy DSL to a YAML). E.g.:

dataSource:
    pooled: true
    jmxExport: true
    driverClassName: com.mysql.jdbc.Driver
    dialect: org.hibernate.dialect.MySQL5InnoDBDialect
    username: sa
    password:

environments:
    development:
        dataSource:
            dbCreate: create-drop
            url: jdbc:mysql://liveip.com/liveDb

中的 dependencies 中的 runtime 添加mysql deps > build.gradle 。例如

Add the mysql deps as runtime in the dependencies of your build.gradle. E.g.

runtime 'mysql:mysql-connector-java:5.1.36'

这篇关于如何将Grails 3.0连接到我的本地Mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆