Connect the local Springboot project to the Aliyun server MySql database

How to connect the local Springboot project to the Aliyun server MySql database?

1. Security group release

First of all, we need to do the server security group release (the port corresponding to the database on the Alibaba Cloud server and the pagoda panel). If you don’t know how to do it, you can read an article I wrote before.
Alibaba Cloud ECS server database creation and connection (pagoda connection)

2. Test connection

We can use IDEA's DataBase database connection tool or Sqlyog, Navicat and other tools to try to connect

2-1 Connect using Sqlyog

insert image description here
insert image description here

2-2 Connect using IDEA's DataBase tool

insert image description here
insert image description here

3. Configure the database connection in the project

Configure the database connection in the project configuration file
insert image description here

4. Test whether the project is actually connected to the server database successfully

Simply write a Controller class in the project to return some simple data
insert image description here
and test it in Postman
insert image description here

Guess you like

Origin blog.csdn.net/JavaD0g/article/details/114857611
Recommended