Additional customizing is required for mongodb after initial setup.
-
Create a user administration account. This user only has privileges to manage users and roles, so you can use it to create other users that have permission to manage actual databases. (Details: https://docs.mongodb.com/manual/tutorial/enable-authentication/)
mongo --port 27017
use admin db.createUser( { user: 'userAdmin', pwd: 'ADMINPASSWORD', roles: [ { role: 'userAdminAnyDatabase', db: 'admin' } ] } )
-
Return to bash (or zsh, etc) shell: ^ d
-
Update
${HOMEBREW}/etc/mongodb.conf
security: authorization: "enabled"
-
Restart mongod with auth
brew services restart mongodb-community --auth
-
Start a mongo shell with
userAdmin
mongo --port 27017 -u "userAdmin" -p "ADMINPASSWORD" --authenticationDatabase "admin"
-
Create a superuser
use admin db.createUser({ user: "[USERNAME]", pwd: "[YOURPASSWORD]", roles: [ { role: "dbAdminAnyDatabase", db: "admin" }, { role: "readWriteAnyDatabase", db: "admin" }, ] })
Additional customizing is required for rethinkdb after initial setup.
You'll probably want to change the host port from :8080
to one that won't clobber a lot of local dev sites — something like :8090
.
- Open
${HOMEBREW}/etc/rethinkdb.conf
- Uncomment the
http-port
line and change the value to 8090 - Run
brew services restart rethinkdb
-
Open the data explorer in the RethinkDb admin (e.g. http://localhost:8090)
-
Set password for admin user
r.db('rethinkdb').table('users').get('admin').update({password: '[YOURPASSWORD]'})
-
Create a new user
r.db('rethinkdb').table('users').insert({id: '[USERNAME]', password: '[YOURPASSWORD]'})
-
Grant the new user privileges. For example, granting privileges across all databases:
r.grant('[USERNAME]', {read: true, write: true, config: true})