mongo导出导入
2015-07-02 15:29
676 查看
mongo导出
mongodump --host 127.0.0.1:27017 -d test -c mytest -o /Users/wood/Documents/test_log
--host ip地址:端口号
-d 跟数据库
-c 跟数据表
-o 导出的存放路径
普通的导入
mongorestore --host 127.0.0.1:27017 -d test2 -c mytest2 /Users/wood/Documents/test_log/test/mytest.bson
最后面的路径选择你导出数据库的存放路径,并且选择里面的 .bson文件
如果导入的数据库需要授权的话,则需要填写用户名 密码,并且填写要授权的数据库名字
-u 用户名
-p 密码
--authenticationDatabase 需要授权的数据库名
mongorestore --host 127.0.0.1:27017 -d test2 -c mytest2 -u wood -p 123456 --authenticationDatabase test2 /Users/wood/Documents/test_log/test/mytest.bson
mongodump --host 127.0.0.1:27017 -d test -c mytest -o /Users/wood/Documents/test_log
--host ip地址:端口号
-d 跟数据库
-c 跟数据表
-o 导出的存放路径
普通的导入
mongorestore --host 127.0.0.1:27017 -d test2 -c mytest2 /Users/wood/Documents/test_log/test/mytest.bson
最后面的路径选择你导出数据库的存放路径,并且选择里面的 .bson文件
如果导入的数据库需要授权的话,则需要填写用户名 密码,并且填写要授权的数据库名字
-u 用户名
-p 密码
--authenticationDatabase 需要授权的数据库名
mongorestore --host 127.0.0.1:27017 -d test2 -c mytest2 -u wood -p 123456 --authenticationDatabase test2 /Users/wood/Documents/test_log/test/mytest.bson
相关文章推荐
- UVALive 6665 Dragon’s Cruller (BFS + 优先队列+hash)
- 【Leetcode Algorithm】Invert Binary Tree
- 【Leetcode Algorithm】Rectangle Area
- 【Leetcode Algorithm】Palindrome Number
- 【Leetcode Algorithm】Add Binary
- 【Leetcode Algorithm】ZigZag Conversion
- 【Leetcode Algorithm】String to Integer (atoi)
- 【Leetcode Algorithm】Longest Common Prefix
- 【Leetcode Algorithm】Valid Parentheses
- 【Leetcode Algorithm】Merge Two Sorted Lists
- 【LeetCode】1 Two Sum
- golang 本地构建包
- OC的category和extension
- Diesel-engined Wristwatches is usually connected with good selections to help those who're brilliant plenty of to recognise on-line
- Google Fresco 的使用解决各种问题
- 算法基础:周期串问题
- salesforce---设置页面logo
- Golang slice 切片
- Golang 数组使用
- Golang for循环