shell如何创建mongodb用户
世界只因有你
世界只因有你 2017-05-02 09:18:54
0
1
548

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

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

世界只因有你
世界只因有你

reply all(1)
Ty80

The creation statement is correct. What you are looking for is not in the mongo information. What you need to know is the usage of linux shell and the escaping of spaces or quotes

mongo test --eval "db.createUser({user:\"rwuser\", pwd:\"titan7vc65x\", roles:[{role:\"readWrite\", db:\"test\"}]})"
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!