Spring-Boot-GCP-MYSQL-DB
In this project used username, password, url for db connect
Whitelisted static public address
Steps:
- Simple Project created
- Then SQL->create new instance -> MySQL DB
- Whitelisting IP address GCP UI
- SQL->connections->Networking added IP address.
- Add one simple DB for spring project like: new-db
- Check users in Users tab, also want to change password or view or update password.
- Create normal spring boot project.
- Use MySQL dependency
- used username, password, URL (SQL instance public IP address: port number is optional)
- ddl-auto should be update.
Knowing the static public IP address from any Linux system like: Codespaces, Docker-container, GCP Cloud shell
>ip=$(curl -s https://api.ipify.org)
>echo "Here is my address: $ip"
If you want to connect MySQL DB from GCP Cloud shell then
>mysql -h 35.223.42.83 -u root -p
>show databases;
>use new-db;