以我的数据库为例,在mac下备份,数据库名为world 备份数据库 mongodump -h 127.0.0.1:27017 -d world 在不指定备份目录的情况下默认会在/Users/yuzhanwu(我的主机名)/dump下面,成功界面如下: 还原数据库: mongorestore -h 127.0.0.1:27017 -d world --directoryperdb /Users/yuzhanwu/dump/world 成功界面如下图: