Quick How-To for Grails with MySql
1. install mysql (I’m running 5.0.83)
2. get java driver for mysql http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.10.zip/from/pick#mirrors
3. Open the zip file and extract the jar file into the lib directory of your Grails application.
4. alter the DataSource.groovy file in conf
import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration
dataSource {
configClass = GrailsAnnotationConfiguration.class
pooled = false
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
}
5. development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop','update'
//url = "jdbc:hsqldb:mem:devDB" //jdbc:hsqldb:file:devDB;shutdown=true
url = "jdbc:mysql://127.0.0.1:3306/test"
}
}
6. create a catalog in mysql - ie. test check your url, mine was 127.0.0.1:3306
7. I ran grails console and then wrote some groovy/grom statements to test it ie. println Quote.count()