MySQL-通过SpringBoot访问阿里云MySQL

时间:2020-11-15 18:24:53   收藏:0   阅读:231

将属性配置中的url更改为阿里云的公网IP

spring.datasource.url=jdbc:mysql://ip:3306/test1?serverTimezone=Asia/Shanghai&allowMultiQueries=true

注意此处仍然使用3306端口(需要在阿里云安全组上配置3306端口,同时授权远程连接)

localhost:8080/getUser?id=5

注意此处仍然使用localhost,因为SpringBoot的搭建是在本地,通过8080端口传输

如果SpringBoot直接在阿里云上部署,则可以直接通过公网ip来进行访问

原文:https://www.cnblogs.com/lixin2011/p/13977344.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!