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

CSS to implement QQ browser functions

Code Knowledge Points 1. Combine fullpage.js to a...

Sample code for programmatically processing CSS styles

Benefits of a programmatic approach 1. Global con...

Several skills you must know when making web pages

1. z-index is invalid in IE6. In CSS, the z-index...

Detailed explanation of CSS multiple three-column adaptive layout implementation

Preface In order to follow the conventional WEB l...

How to import txt into mysql in Linux

Preface When I was writing a small project yester...

Detailed steps for yum configuration of nginx reverse proxy

Part.0 Background The company's intranet serv...

js to achieve a simple lottery function

This article shares the specific code of js to im...

MySQL calculates the number of days, months, and years between two dates

The MySQL built-in date function TIMESTAMPDIFF ca...

How to implement scheduled backup of CentOS MySQL database

The following script is used for scheduled backup...

How to find websites with SQL injection (must read)

Method 1: Use Google advanced search, for example...

How to correctly create MySQL indexes

Indexing is similar to building bibliographic ind...

UDP simple server client code example

I won’t go into details about the theory of UDP. ...

Detailed explanation of MySQL file storage

What is a file system We know that storage engine...