mongo的一些操作
mongo语句
mongo 进入mongo
//创建数据库 并切换到此数据库
use admin
//创建新用户 =》在哪个库下就是选择创建哪个库的用户
db.createUser({user:'linewell',pwd:'123456',roles:[{role:"readWrite",db:"LicenseFilesDB"}]})
//删除此数据库的用户
db.removeUser('linewell');
1、开启防火墙
systemctl start firewalld
2、开放指定端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
命令含义:
–zone #作用域
–add-port=6379/tcp #添加端口,格式为:端口/通讯协议
–permanent #永久生效,没有此参数重启后失效
3、重启防火墙
firewall-cmd --reload
4、查看端口号
netstat -ntlp //查看当前所有tcp端口·
netstat -ntulp |grep 6379 //查看所有1935端口使用情况·
db.updateUser( "linewell",
{
roles:[
{role:"readWrite",db:"license"},
{role:"readWrite",db:"LicenseFilesDB"},
{role:"readWrite",db:"CatalogFilesDB"},
{role:"readWrite",db:"InputFilesDB"},
{role:"readWrite",db:"ProcFilesDB"},
{role:"readWrite",db:"ResultFilesDB"},
{role:"readWrite",db:"PreFilesDB"},
{role:"readWrite",db:"materialFilesDB"}
],
pwd:"123456"
}
)