当前位置:网站首页>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远程连接
边栏推荐
- 传输层 知识点总结
- Graduation season · undergraduate graduation thoughts -- the self-help road of mechanical er
- plsql变量赋值问题
- Mysql如何删除数据库表中的某一列
- In May, 2022, China's game manufacturers and applications went to sea, with top 30 revenue in EMEA region
- @“齐鲁多娇”幸运用户,山东5A景区喊你免费游园啦!
- 2022年5月中国游戏厂商及应用出海 EMEA 地区收入30强
- How to do well in R & D efficiency measurement and index selection
- 2022年T电梯修理复训题库及答案
- Behind the fall of the first Seberg: the extreme race between technology and frostbite
猜你喜欢

docker: Error response from daemon: Conflict. The container name “/mysql“ is already in use by conta
![Azkaban startup error 2022/06/20 21:39:27.726 +0800 error [stdouterrredirect] [azkaban] exception in thread](/img/02/2e402f05022b36dc48ff47232e8535.png)
Azkaban startup error 2022/06/20 21:39:27.726 +0800 error [stdouterrredirect] [azkaban] exception in thread "m

sqlserver保存时遇到这个页面怎么回事啊

2022年G2电站锅炉司炉题库及在线模拟考试

When do project managers particularly want to escape from work?

知乎热问:一个程序员的水平能差到什么程度?

docker: Error response from daemon: Conflict. The container name “/mysql“ is already in use by conta

缺失值处理

国产手机干翻苹果?原来是靠百元机和猛降价实现的

Activity启动流程梳理
随机推荐
数据库行业分析:从全球IT产业趋势到国产数据库发展之路
[small program project development -- Jingdong Mall] rotation chart of uni app development
@Lucky user of "Qilu Duojiao", Shandong 5A scenic spot calls you to visit the park for free!
Babbitt | yuancosmos daily must read: it is said that Tencent has established XR department, and yuancosmos sector has risen again. Many securities companies have issued reports to pay attention to th
腾讯云国际版云服务器欠费说明
2022焊工(初级)特种作业证考试题库模拟考试平台操作
Excuse me, when cdc2.0 reads mysql, there should be no table lock. An error was just reported, access D
Explain the startup process of opengauss multithreading architecture in detail
In May, 2022, China's game manufacturers and applications went to sea, with top 30 revenue in EMEA region
项目经理们在哪个时刻特别想逃离工作?
A course for New Oriental transformation bilingual live broadcast to bring goods to the project manager
SOA面向服务的架构
[轻松学会shell编程]-4、单引号和双引号的区别、整形数值的运算、shell中数组定义和sed的详细用法
【owt】owt-client-native-p2p-e2e-test vs2017 构建
问下 cdc 2.2.1监控sqlServer是不支持监控多库的吗?
基于转换器 (MMC) 技术和电压源转换器 (VSC) 的高压直流 (HVDC) 模型(Matlab&Simulink实现)
Gridhome, a must-have static site generator for beginners
The world's first AR contact lens, the entrance of metauniverse is really opened this time?
使用完整功能模仿设计法
如何做好研发效能度量及指标选取