Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux installation of mysql database and method of configuring Java project

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "linux installs mysql database and how to configure Java project". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "linux installs mysql database and how to configure Java project".

First, install mysql database

① downloads and unzips and uploads to the / opt/soft directory (the soft directory is self-created)

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

③ empties the database that comes with linux

1. Check to see if there is an older version of the database:

Rpm-qa | grep mysql

Rpm-qa | grep mariadb

two。 Uninstall the existing database: (uninstalling will uninstall the dependent packages of this package as well)

Yum-y remove mariadb-libs.x86_64

④ installs the mysql Community Edition service pack:

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

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

1. Install the dependency package for perl:

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

two。 Install the dependency package for mysql-community-client:

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

Find 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. Reinstall mysql-community-cient-5.7.27-1.el7.x86_64.rpm

4. Install the dependency package for 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

⑥ verifies whether mysql is installed successfully (startup does not report an error means installation is successful)

Start the mysql service: systemctl start mysqld.service

Find the temporary password and change it

① looks for the file where the temporary password is stored:

Find /-name mysql*log

② view temporary password:

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

(password is c_xmovu7jjcw)

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

④ in the environment of mysql database:

1. Set the mysql password policy:

Mysql > set global validate_password_policy=0

two。 Set the length of the mysql password:

Mysql > set global validate_password_length=4

3. Set the password:

Mysql > set password=password ('123456')

4. Exit: quit; or ctrl+z

View and create remotely connected users

① checks to see if users can connect remotely:

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

two。 Enter: use mysql

3. Viewing: select host,user,authentication_string from user

② creates a remote user

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

two。 Permission granted: grant all privileges on *. * to 'myroot'@'%'

3. Refresh: flush privileges

Use the navicat tool to log in remotely

① turns off the firewall: systemctl stop firewalld.service

② to connect

③ connected successfully

Configure the java project

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

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

② imports the .sql packet into navicat (after connecting, left-click, and then click to run the sql file)

③ starts the tomcat service: (to start under the bin directory under the apache-tomcat-8.5.47 directory)

Sh startup.sh

④ modifies the file in which the project connects to the database so that the project connects to the database

Default path: (automatically decompress the project after uploading, refresh it first)

/ opt/sotp/apache-tomcat-8.5.47/webapps/test/web-inf/classes

Modify:

1. Ip address of database service: (change to ip address of linux)

two。 Database name: (change to project database name)

3. User name of the remote connection user: (user name myroot)

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

5. Save

⑥ turn off the firewall:

Systemctl stop firewalld.service

⑦ open web page: enter 192.168.1.181:8080/test

⑧ input user name and password to test login

⑨ login

At this point, I believe you have a deeper understanding of "linux installs the mysql database and configure the Java project". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report