Teach you how to build java, Tomcat, MySQL in linux environment! ! !

One, install Java

0, upload jdk to the specified directory

Insert picture description here

1. Unzip and move to the specified directory

unzip:

tar -zxvf jdk-8u152-linux-x64.tar.gz

Insert picture description here
Create a directory:

mkdir -p /usr/local/java

Insert picture description here
Mobile installation package:

mv jdk1.8.0_152/ /usr/local/java/

Insert picture description here
Insert picture description here
Set owner:

chown -R root:root /usr/local/java/

Insert picture description here

2. Configure environment variables

Configure system environment variables:

vim /etc/environment #打开environment 文件
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
export JAVA_HOME=/usr/local/java/jdk1.8.0_231
export JRE_HOME=/usr/local/java/jdk1.8.0_231/jre
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib

Insert picture description here
Configure user environment variables:

vim /etc/profile #打开profile 文件

export JAVA_HOME=/usr/local/java/jdk1.8.0_231
export JRE_HOME=/usr/local/java/jdk1.8.0_231/jre
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin

Insert picture description here
Enable user environment variables to take effect

source /etc/profile
3. Verify that the installation is successful
java -version

Insert picture description here

Two, install Tomcat

1. Unzip and move to the specified directory

unzip:

tar -zxvf apache-tomcat-9.5.35.tar.gz

Insert picture description here
Change directory:

mv apache-tomcat-9.0.35 tomcat

Insert picture description here

2. Verify that the installation is successful

Start: enter the bin directory of tomcat

./startup.sh

Insert picture description here
Insert picture description here
stop:

./shutdown.sh

Insert picture description here
Insert picture description here

Three, install MySQL

1. Installation

Update the data source:

yum update

Insert picture description here
Download and install the official Yum Repository of MySQL:

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

Insert picture description here
Use yum command to install mysql57-community-release-el7-10.noarch.rpm

yum -y install mysql57-community-release-el7-10.noarch.rpm

Insert picture description here
Install mysql server

yum -y install mysql-community-server

Insert picture description hereInsert picture description here

2. Start MySQL
systemctl start  mysqld.service

View the execution status of MySQL

systemctl status mysqld.service

Insert picture description here

3. Check the database password:

Go to the /var/log directory to view the mysqld.log file. Use / add the password you want to search to see the password initialized by mysql itself. My password here is: 6sBelK-eMajY
Insert picture description here
Insert picture description here

4. Connect to the database

Insert picture description here
Check it

select * from dual;

Insert picture description here
An error was reported, the reason is that before executing the statement, you must use the ALTER USER statement to reset the password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin123';

It was wrong! ! ! [Password policy problem exception information]
Insert picture description here
First set a slightly more complicated

ALTER USER 'root'@'localhost' IDENTIFIED BY 'ZHANGadmin123.';

Insert picture description here
View password policy:

SHOW VARIABLES LIKE 'validate_password%'; 

Insert picture description here

5. About mysql password policy related parameters:
  1. validate_password_length The total length of the fixed password
  2. validate_password_dictionary_file specifies the file path for password verification
  3. validate_password_mixed_case_count The entire password must contain at least the total number of uppercase and lowercase letters
  4. validate_password_number_count The entire password must contain at least the number of Arabic numerals
  5. validate_password_policy specifies the password strength verification level. The default
    value is MEDIUM . The value of validate_password_policy:
    0/LOW: only verify length
    1/MEDIUM: verify length, numbers, uppercase and lowercase, special characters
    2/STRONG: verify length, numbers, uppercase and lowercase, Special characters, dictionary files
  6. validate_password_special_char_count The entire password must contain at least the number of special characters

Modify the password rules [Don't do this online]
1. Change the password verification level to only verify length
2. Set the length to 5
Insert picture description here
and then test again.
Insert picture description here
You're done! ! !

6. Attention! ! !

But there is still a problem at this time, because the Yum Repository is installed, and every yum operation will be automatically updated in the future, you need to uninstall this: mysql57-community-release-el7-10.noarch
exit the database first
Insert picture description here

yum -y remove mysql57-community-release-el7-10.noarch

Insert picture description here

7. Remote connection

It is impossible to perform data operations here, let's connect with Navicat, but woc can't connect
! ! !
Insert picture description here
Don't worry! Follow the steps below to modify it:

use mysql; #选择数据库
update user set host ='%' where user = 'root'; # 修改远程机器访问 root 用户
flush privileges;

Insert picture description here
Insert picture description here
connection succeeded! ! !
Insert picture description here

Writing is not easy to focus on three batter, I will always continue to look forward to the next phase of the output ... linux configuration Thank you!
Encourage you...

Guess you like

Origin blog.csdn.net/weixin_38071259/article/details/106571606