Detailed graphic explanation of installing MySQL database and configuring Java project on Linux

Detailed graphic explanation of installing MySQL database and configuring Java project on Linux

1. Install MySQL database

① Download and unzip and upload to the /opt/soft directory (the soft directory is created by yourself)

②Unzip: tar -xvf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar

③Clear the database that comes with Linux

1. Check if there is an old version of the database:

rpm -qa |grep mysql

rpm -qa | grep mariadb

2. Uninstall the existing database: (Uninstalling will also uninstall the dependent packages of this package)

yum -y remove mariadb-libs.x86_64

④Install MySQL community edition service package:

rpm -ivh mysql-community-server-5.7.27-1.el7.x86_64.rpm

It is found that 5 dependent packages are needed, so install the dependent packages first (needed dependencies)

1. Install perl's dependency packages:

yum -y install perl (here 27 packages with perl are installed, including 3 dependent packages)

2. Install the dependency package of mysql-community-client:

rpm -ivf mysql-community-client-5.7.27-1.el7.x86_64.rpm

It is found that this package depends on: mysql-community-libs, so install the mysql-community-libs package first.

Install the mysql-community-libs library package:

rpm -ivf mysql-community-libs-5.7.27-1.el7.x86_64.rpm

3. Install mysql-community-cient-5.7.27-1.el7.x86_64.rpm

4. Install the dependency package of mysql-community-common:

rpm -ivf mysql-community-common-5.7.27-1.el7.x86_64.rpm

⑤Install the MySQL community edition server package again:

rpm -ivh mysql-community-server-5.7.27-1.el7.x86_64.rpm

⑥Verify whether MySQL is installed successfully (if there is no error when starting, it means the installation is successful)

Start the mysql service: systemctl start mysqld.service

2. Find the temporary password and modify it

①Find the file that stores the temporary password:

find / -name mysql*log

②View temporary password:

more /var/log/mysql.log | grep temp

(The password is C_XMoVU7jjcW)

③ Enter mysql -u root -p and the temporary password to log in and enter the mysql database environment

④In the mysql database environment:

1. Set mysql password policy:

mysql>set global validate_password_policy=0;

2. Set the length of the mysql password:

mysql>set global validate_password_length=4;

3. Set password:

mysql>set password=password('123456');

4. Exit: quit; or ctrl+z

3. View and create remote connection users

① Check whether the user can connect remotely:

1. Log in: mysql -u root -p; enter the password to log in (123456)

2. Enter: use mysql;

3. View: select host,user,authentication_string from user;

②Create a remote user

1. Create a user: create user 'myroot'@'%' identified by '123456';

2. Grant permissions: grant all privileges on *.* to 'myroot'@'%';

3. Refresh: flush privileges;

4. Use Navicat tool to log in remotely

① Turn off the firewall: systemctl stop firewalld.service

② Make a connection

③Connection successful

5. Configure the Java project

The project contains: program package (.war) + data package (.sql)

①Upload the .war and program packages to the wbapps directory under tomcat (in the /opt/soft/apach-tomcat-8.5.47 directory)

② Import the .sql data package into Navicat (after connecting, left-click, and then click Run SQL File)

③Start the tomcat service: (Start in the bin directory under the apache-tomcat-8.5.47 directory)

sh startup.sh

④Modify the file that connects the project to the database so that the project can connect to the database

Default path: (The project will be automatically decompressed after uploading, refresh it first)

/opt/sotp/apache-tomcat-8.5.47/webapps/test/WEB-INF/classes

Revise:

1. Database service IP address: (Change to Linux IP address)

2. Database name: (Change to the project database name)

3. Username of the remote connection user: (username myroot)

4. Password of the remote connection user: (password of user myroot)

5. Save

⑥ Turn off the firewall:

systemctl stop firewalld.service

⑦Open the web page: enter 192.168.1.181:8080/test

⑧Enter username and password to test login

⑨Log in

The above is all the knowledge points about installing MySQL and configuring Java on Linux introduced this time. Thank you for your learning and support for 123WORDPRESS.COM.

You may also be interested in:
  • mysql-5.7.28 installation tutorial in Linux
  • Detailed tutorial on using cmake to compile and install mysql under linux
  • Tutorial on binary compilation and installation of MySql centos7 under Linux
  • How to configure Java environment variables in Linux system
  • Installation and configuration of Java environment variables under Linux
  • Detailed steps for installing Java and configuring environment variables in Linux CentOS 7.0

<<:  Vue custom table column implementation process record

>>:  Explanation of the use of GROUP BY in grouped queries and the SQL execution order

Recommend

Vue implements the frame rate playback of the carousel

This article example shares the specific code of ...

How to start tomcat using jsvc (run as a normal user)

Introduction to jsvc In production, Tomcat should...

CSS3 achieves cool 3D rotation perspective effect

CSS3 achieves cool 3D rotation perspective 3D ani...

Reasons and solutions for MySQL selecting the wrong index

In MySQL, you can specify multiple indexes for a ...

Initial summary of the beginner's website building tutorial

After writing these six articles, I started to fee...

WeChat Mini Program implements the likes service

This article shares the specific code for the WeC...

9 Tips for Web Page Layout

<br />Related articles: 9 practical suggesti...

Vue implements a draggable tree structure diagram

Table of contents Vue recursive component drag ev...

A case study on MySQL optimization

1. Background A sql-killer process is set up on e...

A brief analysis of the difference between ref and toRef in Vue3

1. ref is copied, the view will be updated If you...

Example code for implementing card waterfall layout with css3 column

This article introduces the sample code of CSS3 c...

How to pass the value of the select drop-down box to the id to implement the code

The complete code is as follows : HTML code: Copy ...

MySQL 5.7 deployment and remote access configuration under Linux

Preface: Recently I am going to team up with my p...

Detailed process of installing various software in Docker under Windows

1. Install MySQL # Download mysql in docker docke...