how to connect mysql

  • build.gradle
    • dependency
      • runtime 'mysql:mysql-connector-java:5.1.36'
  • application.yml
    • dataSource:
          pooled: true
          jmxExport: true
          driverClassName: com.mysql.jdbc.Driver
          dialect: org.hibernate.dialect.MySQL5InnoDBDialect
          username: wexapp
          password: abc123
      
      environments:
          development:
              dataSource:
                  dbCreate: create-drop
                  url: jdbc:mysql://liveip.com/liveDb
  • from stack overflow
    • url
    • 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'
Advertisements
This entry was posted in Grails. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s