您的位置:首页 > 运维架构 > Tomcat

我也不知道写了些啥,就是在安装linux,以及在linux里面装jdk,mysql。tomcat的一些笔记

2018-05-09 09:33 483 查看
安装mysql的命令
yum localinstall mysql80-community-release-el7-1.noarch.rpm    
yum install mysql-community-server


检查mysql是否安装好

yum repolist enabled | grep "mysql.*-community.*" 

 启动MySQL服务            

systemctl start mysqld                            





-------------------tomcat------------------
usr/local/apache-tomcat-8.5.13/bin
chmod u+x *.sh     给tomcat赋予.sh权限
./startup.sh
-------------------idea快捷键---------------------------
sout:syso
psvm   main方法
ctrl+l:查找并替换
ctrl+shift+N:直接查找某个文件




----------------------cmd------------------------
cd:切换目录
cls:cmd中清屏
netstat -aon|findstr ”80”    :查看80这个端口被1188进程占用
tasklist | findstr 1188  :1188是被java.exe用
taskkill /pid 1188 /F      :杀死1188进程


smb171027




*********************mongodb***************************


安装mongoDB服务以管理员身份运行:> mongod  --storageEngine mmapv1 --dbpath "g:\mongodb\db" --logpath "g:\mongodb\log\MongoDB.log" --install --serviceName "MongoDB" 
net start MongoDB                         :启动服务
mongo        :打开mongo的shell
use student                           :创建或者切换一个名为student的库
show dbs                             :查看现有的数据库
db.comparisonData.distinct('tel').length       :去重查询tel的数量
show collections                       :显示数据库中的集合 
db.users.find()         :查找users集合中所有数据
db.users.findOne()                         :查找users集合中的第一条数据
db.web.save({"name":"老李"})                   :创建了名为web的集合,并新增了一条{"name":"老李"} 的数据
db.web.insert({"name":"ghost", "age":10})      :在web集合中插入一条新数据,如果没有web这个集合,mongodb会自动创建
db.users.remove({}) ?        :删除users集合下所有数据
db.users.remove({"name": "lecaf"})             :删除users集合下name=”lecaf”的数据
db.users.drop()或db.runCommand({"drop":"users"}) :删除集合users
db.runCommand({"dropDatabase": 1})    :删除当前数据库,注意 此处的1没加双引号。
db.web.update({"name":"a1"}, {"age":10})         :修改name=a1的数据为sex=1,第一个参数是查找条件,第二个参数是修改内容,主键不能修改
db.collection.find({"key": value })              :查找key=value的数据
db.collection.find({"key":{ $gt: value }})       :key > value
db.collection.find({"key":{ $lt: value }})       :key < value
db.collection.find({"key":{ $gte: value }})      :key >= value
db.collection.find({"key":{ $lte: value }})      :key < valued
db.collection.find({"key":{ $gt:value1,$lt:value2}})     :value1 < key <value2
db.collection.find({"key":{ $ne:value}})                 :Key <> value(不等于)
db.collection.find({"key":{ $mod:[10,1]}})               :取模运算,条件相当于key % 10 == 1 即key除以10余数为1的
db.collection.find({"key":{ $in:[1,2,3]}})               :属于,条件相当于key等于[ 1, 2, 3 ]中任何一个.
db.collection.find({"key":{ $nin:[1,2,3]}})              :不属于,条件相当于key的值不属于[ 1, 2, 3 ]中任何一个
db.collection.find({"key":{ $size:3}})                   :$size 数量、尺寸,条件相当于key对应的值的数量是3(值必须是数组)
db.collection.find({"key":{ $exists:true|false }})       :$exists 字段存在,true返回存在字段key的数据,false返回不存在字段key的数据
db.singer.find({"tel":{$exists:false}},{"name":1,"tel":1}):查询不包含tel字段的数据
db.collection.find({$or:[{a:1},{b:2}]})                   :符合两个条件中任意一个的数据。$or语法表示或的意思。 注意:MongoDB 1.5.3后版本可用),
   符合条件a=1的或者符合条件b=2的数据都会查询出来 
db.collection.find({"key.subkey" :value })   :内嵌对象中的值匹配,注意:"key.subkey"必须加引号。
db.singer.insert({"name":"test2",score:{"yy":80,"sx":79,"wy":95}}):插入一个name为test2的score(成绩){语文80,数学79,英语95}的人


=============排序===========
db.collection.find().sort({ "key1" : -1 ,"key2" : 1 })   :这里的1代表升序,-1代表降序


=============索引===========
db.COLLECTION_NAME.ensureIndex({KEY:1}) :为自段为COLLECTION_NAME的建一个索引,ensureIndex:关键字;1:正序
db.col.ensureIndex({"title":1,"description":-1}) :多个字段创建索引
db.collection.find().limit(5) :一页显示5条数据;控制返回结果数量,如果参数是0,则当作没有约束,limit()将不起作用
db.collection.find().skip(5).limit(5) :可用来做分页,跳过5条数据再取5条数据
db.collection.find().skip(5).limit(5).count(true) :在加入skip()和limit()这两个操作时,要获得实际返回的结果数,需要一个参数true,否则返回的是符合查询条件的结果总数


===========模糊查询=========
db.collection.find({"name":/刘/}) :模糊查询带“刘”的


***********Mongoose**************
Mongoose库简而言之就是在node环境中操作MongoDB数据库的一种便捷的封装

var mongoose = require("mongoose");
// 连接字符串格式为mongodb://主机/数据库名
mongoose.connect('mongodb://localhost/student);


上面这句的意思是连接到本地的mongodb的student表
// 连接本地mongodb ,本机的ip 127.0.0.1,端口:27017 数据库:student
mongoose.connect("mongodb://127.0.0.1:27017/student",function(err){
    if(!err){//如果连接成功,则打印出connected to Mongodb
      console.log("connected to Mongodb");
    }else{
      console.log("连接失败");//如果连接失败,则抛出异常
    }
});
















































阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: