pom.xml
<dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.23</version></dependency><!-- Spring Boot JDBC --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-jdbc</artifactId></dependency>
application.properties
spring.application.name=你的项目名称(应用名)
spring.datasource.url=jdbc:mysql://你的mysql外网连接ip:你的mysql外网连接端口/你的数据库实例名?useSSL=false&serverTimezone=UTC
spring.datasource.username=你的用户名
spring.datasource.password=你的密码
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
腾讯云服务器操作
- 开启外网地址–获得外网ip和端口
- 添加防火墙策略–3306 tcp
参考指引
腾讯云mysql操作手册