tomcat connects to database mysql

The tomcat connection database is divided into two machines ( one database machine and one tomcat machine )

step

First, mysql should be installed and started

tomcat installed and started

One (tom machine): pull a package and unzip it

tar xf SLSaleSystem.tar.gz -C / web / webapp

Two (tom machine): Edit the Tonmat main configuration file

vim /usr/local/tomcat8/conf/server.xml

150行:输入:<Context docBase="/web/webapp/SLSaleSystem" path="" reloadable="flase" ></Context>

Three: close and start tomcat

/usr/local/tomcat8/bin/shutdown.sh

/usr/local/tomcat8/bin/startup.sh

Four ( database machine): yum installation

yum -y install mariadb-server mariadb

systemctl start mariadb

mysql

Five ( database machine): enter mysql and enter

create database slsaledb;

grant all on slsaledb.* to admin@'%' identified by '123456';

flush privileges;

exit

Pull a package to redirect to mysql

mysql -uroot < slsaledb-2014-4-10.sql

Six (tom machine): Edit

vim /web/webapp/SLSaleSystem/WEB-INF/classes/jdbc.properties

Change the url : ip address to the address of the tom machine

In unmae :   change to the name on the tom machine ( admin )

Seven (tom machine): start

/usr/local/tomcat8/bin/shutdown.sh

/usr/local/tomcat8/bin/startup/sh

Eight login  username: admin

Password: 123456

 

------------------------------------------

Nine (tom machine )

  vim /usr/local/nginx/conf/nginx.conf

  As shown

 

 

 

 

 

 

Ten (tom machine ) restart

killall -HUP nginx

 

Reprinted in: https://www.cnblogs.com/123456likun/p/11554885.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326438086&siteId=291194637