我的正式服务器centos上的Mysql:
帐号:root
密码: 520hhf
或许正式服务器你们的mysql密码不同,上面只是我自己的正式服务器的mysql帐号密码。
我的项目War打包路径
E:\AdCommunicationProtocol\out\artifacts\AdCommunicationProtocol
我的linux下的Tomcat发布路径
cd /usr/local/src/apache-tomcat-7.0.79/webapps
我的tomcat运行路径
/usr/local/src/apache-tomcat-7.0.79/bin

要把javaweb项目的连接数据库代码需要写上ip和加上数据库表名:127.0.0.1:3306/adocationdata(如下图所示)
温馨提示:127.0.0.1这个ip是tomcat跟mysql通信的ip,所以这个iP是通用的

然后在帐号密码那里需要写linuxmysql上的帐号和密码,然后将项目打包成war格式(如下图所示)






然后在该IDEA中的项目的路径即可找到该打包好的war包

然后将这个war包复制到Winscp上

然后将这个war包目录放入到你安装在Centos中的tomcat的webapps里面
然后mysql数据库需要打包成sql文件,点击sqlyog里面的工具栏,里面有一个存储的选项(如下图所示)


然后选中随便一个要导出的地址,然后导出即可(如下图)


然后将sql文件用SecureCRT这工具去执行,前提要先启动mysql(如下图)
在这个SecureCRT终端输入:mysql -uroot -p 然后输入密码进入mysql终端
然后找到你存放sql文件的那个位置,比如你存放在tmp目录下,那就执行:source /tmp/adocationdata.sql;
然后查询表数据,select*from表名 (记住后面的分号不可缺少)
例如:select * from advertising_information;
备注:如果要直接执行mariaDB里面的数据库数据就输入一下例子:
例如:

然后查询到你当前的数据库数据
然后将java项目的war包放入linux上的tomcat进行编译运行

然后用命令行的方式启动该tomcat

然后用你centos7的ip然后加端口加项目名和图片路径写在浏览器下访问该项目的图片看是否可以在浏览器上输入如下例子的链接有下载图片的效果
http://61.142.249.242:1010/项目名/images/806925899264654265.png
例子解释:Centos7的ip然后后面加上java的项目名和图片路径,也就是你存储数据库的整个图片路径(如下图所示)
备注:如果要直接执行mariaDB里面的数据库数据就输入一下例子:
例如:
1.show databases; //查看当前mariaDB数据库有哪些表
2.use adocationdata; //打开当前mariaDB数据库的某个表
3.Select * from advertising_information; //查询当前当前mariaDB数据库的某个表的数据

网友评论