Spring Boot学习笔记之使用Spring Boots实现数据库操作已经写过一篇:https://blog.csdn.net/wangruoao/article/details/83015083
这里跟连接SQL server数据库的时候相比,只修改配置文件application.properties即可:
server.port=8081
#数据库用户名密码设置
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test
spring.datasource.username=root
spring.datasource.password=123456
但是启动App的时候一直报错:MySQL的时候遇到了一个问题:
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
at sun.reflect.NativeConstructorAccessorImpl