Setting up Grails 3.1.0 with MySQL

Viewed 2061

I'm struggling to set up my Grails 3.1.0 application with a local MySQL database (just on WAMP) and nothing I've tried from existing sources are working.

None of the following solutions worked for me:

Non-Solution 1

grails-app/conf/application.yml:

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

build.gradle:

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

Non-Solution 2

Similar, but copying the application.yml and build.gradle files from this Github starter project.

Non-Solution 3

Downloading the MySQL connector jar and referencing it in the build.gradle file according to this answer in the following way:

dependencies {

    ...

    compile files('libs/a.jar')
}

After each attempt, I've run grails clean and rebuilt in IntelliJ. Each method results in the following stack trace:

ERROR org.apache.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool.
java.sql.SQLException: Unable to load class: com.mysql.jdbc.Driver" from ClassLoader:sun.misc.Launcher$AppClassLoader@736e9adb;ClassLoader:sun.misc.Launcher$AppClassLoader@736e9adb
...
Caused by: java.lang.ClassNotFoundException: Unable to load class: com.mysql.jdbc.Driver" from ClassLoader:sun.misc.Launcher$AppClassLoader@736e9adb;ClassLoader:sun.misc.Launcher$AppClassLoader@736e9adb
    at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56) ~[tomcat-jdbc-8.0.30.jar:na]
...
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[na:1.8.0_05]
1 Answers
Related