成都创新互联网站制作重庆分公司

Python删除mongodb数据库和用户,查看Python

#!/usr/bin/env python
#coding:utf-8

from pymongo import MongoClient

client = MongoClient('192.168.6.243', 27017)
db=client['admin']
db.authenticate('root','123456')

#help(db) #查看python操作MongoDB的方法

for i in range(2,900):
    try:
        db = client['s%s' % i]
        db.command("dropUser", "Tany")
        db.command("dropDatabase")
    except:
        print 'not db'

当前名称:Python删除mongodb数据库和用户,查看Python
URL网址:http://cxhlcq.com/article/gjohod.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部