当前位置:Gxlcms > 数据库问题 > Python删除mongodb数据库和用户,查看Python操作mongodb的方法

Python删除mongodb数据库和用户,查看Python操作mongodb的方法

时间:2021-07-01 10:21:17 帮助过:29人阅读

#!/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操作mongodb的方法

标签:try   查看   comm   for   and   python   opd   删除   cli   

人气教程排行