mongodb数据库在Mac上的位置
我对Mac和mongodb都是新手.
I am kind of new to mac as well as mongodb.
我有一个奇怪的疑问,访问在Mac上使用mongodb创建的数据库吗?
I have a weird doubt, accessing the database created using mongodb on mac?
我知道,在Windows中有一个名为c:\ data \ db的文件夹,用于存储我的数据库文件.
I know, in windows there is a folder called c:\data\db, where my database files are stored.
在Mac中,数据库的存储方式和存储位置.
How and where in mac, the database is stored.
我记得做过类似的事情
sudo mkdir -p /data/db
sudo chown `id -u` /data/db
要在Mac上创建这样的文件夹,但是尽管我创建了数据库,但在此文件夹中没有找到任何数据库文件.
to create such a folder on mac, but I didn't find any database file in this folder, though i created a database.
在Mac上保存的数据库文件在哪里?
Where are the database files saved on mac?
任何帮助将不胜感激.
Any help would be really appreciated.
MongoDB的默认数据目录为/data/db
.
The default data directory for MongoDB is /data/db
.
可由 dbpath
选项覆盖在命令行或配置文件中指定.
This can be overridden by a dbpath
option specified on the command line or in a configuration file.
If you install MongoDB via a package manager such as Homebrew or MacPorts these installs typically create a default data directory other than /data/db and set the dbpath in a configuration file.
如果在启动时向mongod
提供了dbpath,则可以检查mongo
shell中的值:
If a dbpath was provided to mongod
on startup you can check the value in the mongo
shell:
db.serverCmdLineOpts()
您会看到类似的值:
"parsed" : {
"dbpath" : "/usr/local/data"
},