To add MySQL, open your BuildConfig.groovy file and add an entry to the dependencies section:
dependencies { runtime 'mysql:mysql-connector-java:5.1.29' }The MySQL driver jar will be loaded when you run your Grails application in development mode. It will also be included in the war file when you create a war out of your Grails application.
To connect to a MySQL server, you also need to edit your DataSource.groovy to the correct connection url, db user, and db user password. For example:
dataSource { pooled = true driverClassName = "com.mysql.jdbc.Driver" dialect = "org.hibernate.dialect.MySQL5InnoDBDialect" } hibernate { cache.use_second_level_cache = true cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' } environments { development { dataSource { dbCreate = "create-drop" url = "jdbc:mysql://localhost/test" username = "admin" password = "mysecretadminpassword" } } test { dataSource { ... } } production { dataSource { ... } } }Now your application can talk to a MySQL database