- SQL script:
db.sql
- WAR file:
target -> login.war
Before running, please make sure that the SQL server is running in the background.
-
start server
cd ..\mysql\bin
mysqld --console
-
run the code
cd ..\login
mvn jetty:run
into terminal
Website: http://localhost:8080/login/view/login.jsp
- Java jdk
- maven
- mysql
- mysql jdbc driver
- add JAVA_HOME into sys environment (Eg.
C:\Progra~1\Java\jdk-12.0.1
) - add MAVEN_HOME into sys environment (Eg.
C:\Progra~1\apache-maven-3.6.3
) - add path:
%MAVEN_HOME%\bin;
to environment
-
Download MySQL Community Server "ZIP ARCHIVE" from https://dev.mysql.com/downloads/mysql/:
- Under "Other Downloads", download "Windows (x86, 64-bit), ZIP ARCHIVE (mysql-8.0.{xx}-winx64.zip)".
- Under "Other Downloads", download "Windows (x86, 64-bit), ZIP ARCHIVE (mysql-8.0.{xx}-winx64.zip)".
-
UNZIP the downloaded file into your project directory
"C:\MySQL"
. MySQL will be unzipped as"c:\MySQL\mysql-8.0.{xx}-winx64"
.- For EASE OF USE, we shall shorten and rename the directory to
"c:\MySQl\mysql"
. Take note and remember your MySQL installed directory!!!
- For EASE OF USE, we shall shorten and rename the directory to
-
(NEW since MySQL 5.7.7) Initialize the database: Start a CMD (as administrator) ("Search" button ⇒ Enter "cmd" ⇒ Right-Click on "Command Prompt" ⇒ Run as Administrator) and issue these commands:
- Change directory to the MySQL's binary directory
- Eg. Suppose that your MySQL is installed in "c:\MySQL\mysql"
cd \MySQL\mysql\bin
- Change directory to the MySQL's binary directory
-
Initialize the database. Create a root user with random password & show the messages on console.
mysqld --initialize --console
- A temporary password is generated for root@localhost: xxxxxxxx
- During the installation, a superuser called root is created with a temporary password, as shown above. TAKE NOTE of the PASSWORD, COPY and SAVE it somewhere, and also TAKE A PICTURE!!!
- A temporary password is generated for root@localhost: xxxxxxxx
-
If you make a mistake or forgot your password, DELETE the entire MySQL directory "C:\MySQL\mysql", and REPEAT step 2 and 3.
-
Startup server
-
Change the current directory to MySQL's binary directory
-
Eg. Assume that the MySQL installed directory is "c:\MySQL\mysql"
cd \MySQL\mysql\bin
-
Start the MySQL Database Server
mysqld --console
-
-
Start client
-
Change the current directory to MySQL's binary directory
-
Eg. Assume that the MySQL installed directory is "c:\MySQL\mysql"
cd \MySQL\mysql\bin
-
Start a client as superuser "root" (-u), and prompt for password
mysql -u root -p
-
-
To change password:
alter user 'root'@'localhost' identified by 'xxxx';
-
To create new user:
create user 'myuser'@'localhost' identified by 'xxxx';
To grant permission to new user:grant all on *.* to 'myuser'@'localhost';
-
change setting in code. go to src -> main -> java -> model -> authentication.java
In line 26, change the user and password according to your mysql account that is set up above
-
start server
cd ..\mysql\bin
mysqld --console
-
start client
cd ..\mysql\bin
mysql -u myuser -p
myuser is username. password will be requested. -
run script
source ..\login\db.sql;