Linux JDK Tomcat Mysql5.7

JDK

The download address: jdk1.8

1. uncompress to /usr/java/

┌─[root@nedrain]─[/usr/java]
└──╼ $ls
jdk1.8.0_251  jdk-8u251-linux-x64.tar.gz

2. configure the environment

vim /etc/profile

//add these lines at the bottom
#jdk
export JAVA_HOME=/usr/java/jdk1.8.0_251
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin

// source the file
source /etc/profile

3. java -version

┌─[root@nedrain]─[/usr/java]
└──╼ $java -version
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)

Mysql 5.7 for Centos

1. download this thing(I really don't know why this guy)

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

2. install the yum downloaded

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

3. install mysql server

yum -y install mysql-community-server

4. start the mysql service

┌─[root@mycentos]─[~]
└──╼ $systemctl start  mysqld.service // start
┌─[root@mycentos]─[~]
└──╼ $systemctl status mysqld.service  // check it 
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-06-19 05:43:28 EDT; 11s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 16071 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 16022 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 16074 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─16074 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/my...

Jun 19 05:43:23 mycentos systemd[1]: Starting MySQL Server...
Jun 19 05:43:28 mycentos systemd[1]: Started MySQL Server.

5. find the password generated for root

grep "password" /var/log/mysqld.log
// you will see
┌─[root@mycentos]─[~]
└──╼ $grep "password" /var/log/mysqld.log
2020-06-19T09:43:24.809876Z 1 [Note] A temporary password is generated for root@localhost: VrI3RStYm#j;

5.1 but, the password generated may not be able to work!!! if that, use:

vim /etc/my.cnf

// and this line at the bottom
skip-grant-tables=1

//then restart the mysql service
systemctl restart mysqld.service

// log in without password
mysql -u root

// choose database "mysql"
use mysql;

// update table "user"
update user set authentication_string = password('***************')where user='root';

//then exit mysql and delete that line in /etc/my.cnf
vim /etc/my.cnf

//restart the service
systemctl restart mysqld.service

// do it 
mysql -u root -p
┌─[root@mycentos]─[~]
└──╼ $mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.30

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit;
Bye

6. input the new password

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

7. delete the yum repository

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

tomcat

1. uncompress to /usr/tomcat

┌─[root@nedrain]─[/usr/tomcat]
└──╼ $ls
apache-tomcat-8.5.56  apache-tomcat-8.5.56.tar.gz

and it's done.

猜你喜欢

转载自www.cnblogs.com/nedrain/p/13164473.html