lighthouse@VM-20-16-ubuntu:~$ mongo MongoDB shell version v3.6.3 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.6.3 Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user Server has startup warnings: 2022-04-05T10:24:22.514+0800 I STORAGE [initandlisten] 2022-04-05T10:24:22.514+0800 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine 2022-04-05T10:24:22.514+0800 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem 2022-04-05T10:24:22.830+0800 I CONTROL [initandlisten] 2022-04-05T10:24:22.830+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2022-04-05T10:24:22.830+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2022-04-05T10:24:22.830+0800 I CONTROL [initandlisten] >
创建用户,针对上面的Access control is not enabled for the database.这条警告,创建管理员来增强权限控制。