当前位置:网站首页>centerOS 安装mangodb
centerOS 安装mangodb
2022-06-22 17:15:00 【spring-java】
1、https://www.mongodb.com/try/download/enterprise,下载安装包
2、解压
[[email protected] ~]# tar -zxf mongodb-linux-x86_64-4.0.3.tgz -C /usr/local/
[[email protected] local]# mv mongodb-linux-x86_64-4.0.3/ mongodb
3、配置全局环境变量,在任意地方可以使用mongod命令
[[email protected] mongodb]# vim /etc/profile
添加以下配置
export MONGODB_HOME=/usr/local/mongodb
export PATH=$PATH:$MONGODB_HOME/bin
使配置生效 [[email protected] mongodb]# source /etc/profile
4、配置mongodb的数据库
创建这3个文件
[[email protected] mongodb]# mkdir -p /usr/local/mongodb/db
[[email protected] mongodb]# mkdir -p /usr/local/mongodb/logs
[[email protected] mongodb]# touch /usr/local/mongodb/logs/mongodb.log
5、添加mongodb的配置文件
[[email protected] mongodb]# vim mongodb.conf,添加以下配置
dbpath=/usr/local/mongodb/db #数据文件保存地址
logpath=/usr/local/mongodb/logs/mongodb.log #日志保存地址
port=27017 #端口
fork=true #是否后台启动
auth=true #是否开启权限,访问需要用户名和密码
bind_ip=0.0.0.0 #任意ip都能访问
logappend=true
6、启动mangodb
[[email protected] mongodb]# mongod --config /usr/local/mongodb/mongodb.conf
7、添加用户名密码
连接mongodb,打开bin目录下的mongo课执行文件
[[email protected] mongodb]# bin/mongo
连接admin库:
use admin
添加用户密码:
db.createUser({user:“news”,pwd:“news”,roles:[“userAdminAnyDatabase”]})
登录验证:
db.auth(‘news’,‘news’)
注:低版本用db.addUser({user:“news”,pwd:“news”,roles:[“userAdminAnyDatabase”]})
8、停止运行
[[email protected] mongodb]# mongod --shutdown --config /usr/local/mongodb/mongodb.conf
9、使用Robo3T远程连接
边栏推荐
- Live broadcast Preview - 12 first-class Chinese scholars open ICLR 2022
- Jenkins的安装与升级
- 网络智能运维助力运维效率提升
- 请问一下flink mysql-cdc 如何保证server_id全局唯一呢?
- Grafana 9 is officially released, which is easier to use and more cool!
- 缺失值处理
- Five practical tips for power Bi (complimentary books at the end of the article)
- [learn shell programming easily]-4. The difference between single quotation marks and double quotation marks, the operation of integer values, the definition of arrays in the shell and the detailed us
- 同花顺软件是什么?网上开户安全么?
- 【owt】owt-client-native-p2p-e2e-test vs2017 构建
猜你喜欢

Database industry analysis: from the global IT industry trend to the development of domestic databases

Noah fortune plans to land on the Hong Kong Stock Exchange: the performance fell sharply in the first quarter, and once stepped on the thunder "Chengxing case"

项目经理们在哪个时刻特别想逃离工作?

Alibaba cloud cannot find the account security group id problem during the account transfer

2022年T电梯修理复训题库及答案

游戏NFT市场:OpenSea最易被切下的蛋糕

利用Inkscape转换为dxf文件的正确方法 svg导出dxf文件

I became a big enemy when I bought wanghong ice cream

Binary tree practice the second bullet

Some preliminary explorations of avoiding obstacles and finding paths by rays in unity
随机推荐
炒股开户选择哪个券商公司是最安全最好呢
[轻松学会shell编程]-4、单引号和双引号的区别、整形数值的运算、shell中数组定义和sed的详细用法
传输层 知识点总结
Make it more automatic to transfer slow logs and audit logs of RDS (for MySQL) databases to OBS across spaces
Nuxt - Universal(SSR / SSG)/ Single Page App(渲染模式)
Short video with goods source code, save pictures to photo album / Gallery
Sort---
Traditional image -- LBP feature
Mysql如何删除数据库表中的某一列
Filebeat collects log data and transfers it to redis. Different es indexes are created based on log fields through logstash
Live broadcast Preview - 12 first-class Chinese scholars open ICLR 2022
docker: Error response from daemon: Conflict. The container name “/mysql“ is already in use by conta
如何做好研发效能度量及指标选取
思维的定义
RSPS2022 Finalist | Dr. Yang Bai 简介
[small program project development -- Jingdong Mall] rotation chart of uni app development
新东方转型双语直播带货给项目管理人的一场课
Pytoch -- error reporting solution: "torch/optim/adamw.py" beta1, unboundlocalerror: local variable 'beta1‘
What is flush software? Is it safe to open an account online?
Pytorch——报错解决:“torch/optim/adamw.py” beta1, UnboundLocalError: local variable ‘beta1‘