Skip to content

Harish-git-code/spring-boot-mysql-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot MySQL Example

Pre-requisitess:

  1. Set up a VM with Ubuntu 20.04
  2. Update and upgrade packages
apt-get update 
apt-get upgrade
  1. Navigate to root
sudo su
  1. Install GIT
apt install git
  1. Install JAVA 1.8.0
apt-get install openjdk-8-jdk
  1. Install MAven
apt-get install maven
  1. Install MYSQL server
apt-get update
apt-get install mysql-server
systemctl start mysql.service
  1. Install MySQL Client
apt-get install mysql-client
  1. Configure root username and password for MYSQL
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password123';
exit

Setup Database:

  1. Connect to MYSQL server and create below database
mysql -uroot -ppassword123
CREATE DATABASE springboot_mysql_example;
SHOW DATABASES;
exit

Application Build and Deployment:

  1. Clone source code in to ubuntu machine
  2. Configuration changes in application properties files Navigate to "application.properties" file and open
cd spring-boot-mysql-example/src/main/resources/
vi application.properties

Ensure below entries have correct MYSQL Connection credentials:

spring.datasource.url= jdbc:mysql://localhost:3306/springboot_mysql_example?useSSL=false
spring.datasource.username= root
spring.datasource.password= password123

SAVE the file and EXIT

  1. Build the application Navigate to root folder of the application. Change path location according to your machine
cd spring-boot-mysql-example
mvn install

Expected Output: [INFO] BUILD SUCCESS

  1. Validate build Navigate to target folder
cd spring-boot-mysql-example/target
JAR file (spring-boot-mysql-0.0.1-SNAPSHOT.jar) must present in Target folder
  1. RUN JAR File
cd spring-boot-mysql-example/target
java -jar spring-boot-mysql-0.0.1-SNAPSHOT.jar

Expected Output: Started SpringBootMySqlApplication in 6.593 seconds (JVM running for 7.206)

  1. Browse Application: http://192.168.200.135:8080/ Change IP to Ubuntu machine IP

About

spring-boot-mysql-example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 55.5%
  • HTML 36.6%
  • Shell 7.9%