Configure MySQL db for a Spring-MVC project

2019-06-02 07:08发布

问题:

My current Database properties are as follows:

I want my Database to be MySQL. Can someone please guide me how to change the properties so it gets saved in MySQL.

I have installed MySQL on my Mac OSX. The Username is Root12 and password is xxx

回答1:

Well, you just need to replace all the properties appropriately:

  • the driverClassName is usually com.mysql.jdbc.Driver
  • the url should be like jdbc:mysql://host:3306/databaseName
  • the username and password you already have
  • dialect depends on ORM you are using, for ex for hibernate here is the list

This is the basic configuration



回答2:

this should work:

datasource.driverClassName=com.mysql.jdbc.Driver
dataSource.url=jdbc:mysql://localhost/test

hibernate.dialect=org.hibernate.dialect.MySQL5Dialect