重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
今天就跟大家聊聊有关MongoDB制定路径登陆创建的方法是什么,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
站在用户的角度思考问题,与客户深入沟通,找到商水网站设计与商水网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站设计、成都做网站、企业官网、英文网站、手机端网站、网站推广、国际域名空间、网页空间、企业邮箱。业务覆盖商水地区。1.下载mongodb的系统包
wget /tupian/20230522/mongodb-linux-x86_64-3.6.9.gz
2.解压压缩包
[root@oracle ~]# tar -zxvf mongodb-linux-x86_64-3.6.9.tgz
[root@oracle ~]# ls
anaconda-ks.cfg mongodb-linux-x86_64-3.6.9 模板 文档 桌面
install.log mongodb-linux-x86_64-3.6.9.tgz 视频 下载
install.log.syslog 公共的 图片 音乐
3.将解压包改名为在
[root@oracle ~]# cp -rf mongodb-linux-x86_64-3.6.9 /usr/local/mongodb-3.2
[root@oracle ~]# cd /usr/local/mongodb-3.2/bin/
[root@oracle bin]# ls
bsondump mongo mongodump mongofiles mongoperf mongorestore mongostat
install_compass mongod mongoexport mongoimport mongoreplay mongos mongotop
4.创建数据库目录
[root@oracle bin]# mkdir -p /data/mongodb/data
[root@oracle bin]# mkdir -p /data/mongodb/logs
[root@oracle bin]# touch /data/mongodb/logs/mongodb.log
[root@oracle bin]# /usr/local/mongodb-3.2/bin/mongod
mongod mongodump
5.启动的MongoDB
[root@oracle bin]# /usr/local/mongodb-3.2/bin/mongod --dbpath=/data/mongodb/data/ --logpath=/data/mongodb/logs/mongodb.log --logappend -port=27017 --fork
about to fork child process, waiting until server is ready for connections.
forked process: 23372
child process started successfully, parent exiting
[root@oracle bin]# ls
bsondump mongo mongodump mongofiles mongoperf mongorestore mongostat
install_compass mongod mongoexport mongoimport mongoreplay mongos mongotop
6.进入数据库
[root@oracle bin]# ./mongo
MongoDB shell version v3.6.9
connecting to: mongodb://127.0.0.1:27017
Implicit session: session { "id" : UUID("c5717a03-56b7-4d69-83cf-434a51542a49") }
MongoDB server version: 3.6.9
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
2018-12-13T09:48:46.928+0800 I STORAGE [initandlisten]
2018-12-13T09:48:46.928+0800 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-12-13T09:48:46.928+0800 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten]
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten]
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] ** Start the server with --bind_ip
to specify which IP2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-12-13T09:48:47.803+0800 I CONTROL [initandlisten]
2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten]
2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten]
2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2018-12-13T09:48:47.804+0800 I CONTROL [initandlisten]
> use DATABASE_NAME
如果数据库不存在,则创建数据库,否则切换到指定数据库。
switched to db DATABASE_NAME
> use kingscc
switched to db kingscc
> show dbs
( 查看都有什么数据库,里面没有数据的数据库不显示)
admin 0.000GB
config 0.000GB
local 0.000GB
> db
(显示当前的数据库)
kingscc
> db.kingscc.insert({"name":"kingscc丶"}) (往数据库插入数据)
WriteResult({ "nInserted" : 1 })
> db.dropDatabase() (首先先使用数据库,在进行删除)
{ "dropped" : "kingscc", "ok" : 1 }
> db 删除当前数据库,默认为 test,你可以使用 db 命令查看当前数据库名。
kingscc
[END] 2018/12/13 9:55:10
看完上述内容,你们对MongoDB制定路径登陆创建的方法是什么有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联-成都网站建设公司行业资讯频道,感谢大家的支持。