• Tomcat部署SL商城系统并连接MariaDB数据库


    Tomcat连接数据库

    需要三台虚拟机111   112   113    其中112   113安装Tomcat

    1、以下是112  113的配置:

    [root@localhost ~]# rz
    z waiting to receive.**B0100000023be50

    [root@localhost ~]# tar xf SLSaleSystem.tar.gz -C /web/webapp/

    [root@localhost ~]# vim /usr/local/tomcat8/conf/server.xml

    <Context docBase="/web/webapp/SLSaleSystem" path="" reloadable="flase">
    </Context>

    [root@localhost ~]# /usr/local/tomcat8/bin/shutdown.sh

    [root@localhost ~]# /usr/local/tomcat8/bin/startup.sh

    [root@localhost ~]# tail -f /usr/local/tomcat8/logs/catalina.out

    2、111当做数据库和调度器

    安装数据库

    [root@localhost ~]# yum -y install mariadb mariadb-server

    [root@localhost ~]# systemctl start mariadb

    [root@localhost ~]# mysql                  //登录

    Welcome to the MariaDB monitor. Commands end with ; or g.
    Your MariaDB connection id is 2
    Server version: 5.5.41-MariaDB MariaDB Server

    Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

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

    MariaDB [(none)]> create database slsaledb;
    Query OK, 1 row affected (0.00 sec)

    MariaDB [(none)]> grant all on slsaledb.* to admin@'%' identified by'123456';
    Query OK, 0 rows affected (0.00 sec)

    MariaDB [(none)]> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

    MariaDB [(none)]> exit
    Bye

    [root@localhost ~]# mysql -uroot < slsaledb-2014-4-10.sql                     //导入一个.sql的文件

    3、接下来更改前两台虚拟机,让他们连接数据库

    [root@localhost ~]# vim /web/webapp/SLSaleSystem/WEB-INF/classes/jdbc.properties

    url=jdbc:mysql://192.168.200.114:3306/slsaledb?useUnicode=true&characterEncoding=UTF-8
    uname=admin
    password=123456

    [root@localhost ~]# /usr/local/tomcat8/bin/shutdown.sh

    [root@localhost ~]# /usr/local/tomcat8/bin/startup.sh

    4、去网页上访问,输入用户名密码登录。

  • 相关阅读:
    Linux系统之-TCP-IP链路层
    TCP-IP协议简介
    一些概念
    Bolzano-Weierstrass 定理
    Newton 插值法
    用 Ipe 画图
    Codeforces #677D Vanya and Treasure
    Codeforces #990E Post Lamp
    hihoCoder #1763 道路摧毁
    hihoCoder #1758 加减
  • 原文地址:https://www.cnblogs.com/990624lty-jhc/p/11576634.html
Copyright © 2020-2023  润新知