首页 > shell如何创建mongodb用户

shell如何创建mongodb用户

mongo test --eval db.createUser({user:"rwuser", pwd:"titan7vc65x", roles:[{role:"readWrite", db:"test"}]})

用这个命令也不行,我这边需要shell脚本里创建mongodb用户,网上找不到一点信息。


创建语句没错,你要找的东西不在mongo的资料里面,你需要了解的是linux shell的用法,关于空格或者引号的转义

mongo test --eval "db.createUser({user:\"rwuser\", pwd:\"titan7vc65x\", roles:[{role:\"readWrite\", db:\"test\"}]})"
【热门文章】
【热门文章】