docker run --name mysqldb \
-v mysqldbvol:/var/lib/mysql \
-p 3306:3306 -e MYSQL_USER=<MYSQL-USERNAME> \
-e MYSQL_PASSWORD=<MYSQL-PASSWORD> \
-e MYSQL_DATABASE=<DATABASE> \
-e MYSQL_ROOT_PASSWORD=<ROOT-PASSWORD> \
--rm -d mysql/mysql-server:latest
or
docker run --name mysqldb \
-v mysqldbvol:/var/lib/mysql \
--net=host \
-e MYSQL_ROOT_PASSWORD=<MYSQL-PASSWORD>\
-e MYSQL_ROOT_HOST='%' \
--rm -d mysql/mysql-server:latest
connect to mysql
mysql -h 127.0.0.1 -u <MYSQL-USERNAME> -p
import db schema (e.g schema.sql file)
mysql -h 127.0.0.1 -u <MYSQL-USERNAME> -p <DATABASE> < schema.sql
Create a file named application.properties in src/main/resources/application.properties
jdbc.url=jdbc:mysql://SERVER:PORT/DATABASE?useSSL=false&allowPublicKeyRetrieval=true
jdbc.user=USERNAME
jdbc.password=PASSWORD
jdbc.driver=com.mysql.cj.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
File -> Import -> Git/Projects from Git -> Clone URI
the project url is https://github.com/tsadimas/spring-demo-2021.git
when the prompt to select the kind of project appears, select Import as general project
Next, you should convert the current project to Dynamic Web project. To accomplish this, you should right-click the project and in properties go to Project Facets Enable Faceted Project
and select Dynamic Web Module from the facets list.
Set the default JRE runtime to be Java 11. To accomplish this, right click the project and in Java Build Path, in Libraries Tab edit the JRE System Library to point to your Java 11 runtime (setting the appropriate value to Alternate JRE).
To fix the errors in jsp files, you should again right click the project, and in properties go to Targeted Runtimes and select the Apache Tomcat that is connected to your eclipse workspace.
Also, don't forget to convert the project to maven project (Configure->Convert to Maven Project) and select Maven--> Update Project from the menu appearing when right-clicking the project.
Select Run → Edit Configurations, Then the plus (+) symbol and select Tomcat Server → Local.
Set the location and then press the "fix" button
and select an artifact to deploy.
Go to File → Project Structure Select Modules → [your module name] → Dependencies and click the plus symbol (+)
and select "Application Server Libraries → Tomcat X.X.X"
- [Maven]: Setting the -source and -target of the Java Compiler
- [IntelliJ]: Error:java: release version 5 not supported
- [IntelliJ]: IntelliJ IDEA cannot resolve import javax.servlet.*;
- [IntelliJ]: How to add Resources Folder, Properties at Runtime into IntelliJ classpath? Adding Property files to Classpath
- [git]: What is git tag, How to create tags & How to checkout git remote tag(s)