yum install mariadb database

First, install a host mysql database

1, the installation package

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

2, open service

[root@localhost ~]# systemctl start mariadb

3, to see if there is port 3306

[root@localhost ~]# netstat -anpt 
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:3306            0.0.0.0:*      

4, log database

[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)]> 

Build a database

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

Authorization to the database

MariaDB [(none)]> ON slsaledb * All Grant to ADMIN @. ' % ' IDENTIFIED by ' 123123 ' ; 
Query the OK, 0 rows affected ( 0.00 sec) 

%: connection address may be derived from any

Refresh Authorization Form

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

drop out

MariaDB [(none)]> exit
Bye
[root@localhost ~]# 

5, import data into the database

Adding a * .sql file

[root@localhost ~]# rz -E
rz waiting to receive.
[root@localhost ~]# ls
anaconda-ks.cfg  nginx-1.16.0.tar.gz  slsaledb-2014-4-10.sql

The files into the database

[root@localhost ~]# mysql -uroot < slsaledb-2014-4-10.sql

 

Second, the host installation tomcat connect to the database

1, modify the contents of the page file

[root@localhost ~]# ls /web/webapp/
index.jsp  SLSaleSystem
[root@localhost ~]# ls /web/webapp/SLSaleSystem/
logs  META-INF  statics  WEB-INF
[root@localhost ~]# ls /web/webapp/SLSaleSystem/WEB-INF/
classes  lib  pages  web.xml
[root@localhost ~]# ls /web/webapp/SLSaleSystem/WEB-INF/classes/
applicationContext-mybatis.xml  mybatis-config.xml
jdbc.properties                 org
log4j.properties                spring-servlet.xml
[root@localhost ~]# vim /web/webapp/SLSaleSystem/WEB-INF/classes/jdbc.properties
[root@localhost ~]# vim /web/webapp/SLSaleSystem/WEB-INF/classes/jdbc.properties
= jdbc url \: MySQL \: // 192.168.200.111 \:? 3306 / slsaledb useUnicode \ = to true & characterEncoding \ = UTF-8     // database host IP 

uname = ADMIN    // database username 
password = 123123     // database password

 Test (user name admin, password 123456 login)

 

Guess you like

Origin www.cnblogs.com/tanxiaojuncom/p/11573403.html