本帖最后由 宝塔用_abfd 于 2023-6-12 18:36 编辑
maka是新创建的数据库,连带用户名和密码一同创建的! 只创建了数据库,没有创建用户和密码
- > db.auth('root', '8H4gVYnJWEWUe0sS')
- 1
- > show users;
- {
- "_id" : "admin.root",
- "user" : "root",
- "db" : "admin",
- "roles" : [
- {
- "role" : "root",
- "db" : "admin"
- },
- {
- "role" : "clusterAdmin",
- "db" : "admin"
- },
- {
- "role" : "readAnyDatabase",
- "db" : "admin"
- },
- {
- "role" : "readWriteAnyDatabase",
- "db" : "admin"
- },
- {
- "role" : "userAdminAnyDatabase",
- "db" : "admin"
- },
- {
- "role" : "dbAdminAnyDatabase",
- "db" : "admin"
- },
- {
- "role" : "userAdmin",
- "db" : "admin"
- },
- {
- "role" : "dbAdmin",
- "db" : "admin"
- }
- ]
- }
- > show databases;
- admin 0.000GB
- config 0.000GB
- local 0.000GB
- maka 0.000GB
- > db.auth('maka', '159357')
复制代码
|