How to connect Grails 3.0 to my local Mysql database

你。 提交于 2019-11-30 06:18:20

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

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

runtime 'mysql:mysql-connector-java:5.1.36'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!