Add Me!Close Menu Navigation

Just my humble place...

Add Me!Open Categories Menu

Using MySQL instead of in-memory database for a Grails application

A Grails application by default uses a in-memory HSQL database. To switch to a MySQL database the steps are simple and straightforward.

* Download the MySQL JDBC driver [called a connector] from the [MySQL website][1]
* Extract the zip or tar archive
* Copy the driver (at this time of writing called `mysql-connector-java-5.1.13-bin.jar` into the `grails-app/lib` directory

* Configure your application datasource in file ‘grails-app/conf/DataSource.groovy’

development {
 		dataSource {
 		dbCreate = "create-drop" // one of 'create', 'create-drop','update'
 		url = "jdbc:mysql://localhost/"
 		driverClassName = "com.mysql.jdbc.Driver"
 		port =  // default 3306
 		username = ""
 		password = " "
 	}
}

Use your own database settings!

* Start your Grails application

[1]: http://dev.mysql.com/downloads/connector/j/

Posted By Marco Pas

Leave a Reply