I'm quite new with Grails and trying to connect my application to my local mysql database. Since I'm working with the latest version of Grails, I couldn't really find a lot of documentation to help me out. Is there any clear documentation which could guide me in the right direction?
(I've tried the official documentation, but it seems to be out of date)
To connect to the database server, confirm that the MySQL Database Server is running on your machine, right-click the Databases > MySQL Server node in the Services window and choose Connect. You might be prompted to supply a password to connect to the server.
Go ahead and open MySQL Workbench and let's connect to this new local server. Click on the “New Connection” icon and leave everything default, except the “Connection Name,” here enter localhost . Double click on the new connection and enter the password you created during installation. Voila!
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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With