Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to fix the problem of Mac brew installation mongodb report Error: No available formula with the name 'mongodb'

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to repair Mac brew installation mongodb newspaper Error: No available formula with the name 'mongodb' problem, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to know about it.

According to homebrew-brew 's official explanation, MongoDB is no longer open source and # 43770 has been removed from Homebrew

It is precisely because the commercialization of MongoDB is not ideal, so it chose closed source. As a result, those brew installation methods will be misreported before it is closed. Many articles on the Internet are based on the old installation method, which causes brew to fail to install and report an error.

Error: No available formula with the name 'mongodb'

For the new installation, please refer to the github home page, https://github.com/mongodb/homebrew-brew.

The new installation method tells us that we need to execute:

Brew tap mongodb/brew

And then execute:

Brew install mongodb-community

This is the community version of the installation. If you need to install the specified version, you can take the @ version number.

Brew install mongodb-community@4.2brew install mongodb-community@4.0brew install mongodb-community@3.6

If you only want to install the latest mongoshell, you can execute the following command.

Brew install mongodb-community-shell

If a Download failed or DownloadError: Failed to download resource "mongodb-community" error occurs, repeat the installation command to download. This is your network problem. Try it a few more times.

The default configuration file path after installation is as follows:

# configuration file: / usr/local/etc/mongod.conf# log directory path: / usr/local/var/log/mongodb# data directory path: / usr/local/var/mongodb

With brew, it is convenient to start Mongo and stop Mongo.

# start brew services start mongodb-community# or brew services start mongodb/brew/mongodb-community# and stop brew services stop mongodb-community# or brew services stop mongodb/brew/mongodb-community

After the installation, we need to do some configuration, can not let mongo streaking, over the years there have been a lot of data leakage accidents, we have to configure security certification.

First, after we have successfully started mongo, execute the following command:

# Link mongomongo# to switch db, or create xttbloguse xttblog# to create user admindb.createUser ({user:'admin', pwd:'admin', roles: [{role:'readWrite',db:'xttblog'}]})

If the creation is successful, prompt: Successfully added user.

Successfully added user: {"user": "admin", "roles": [{"role": "readWrite", "db": "xttblog"}]}

It should be noted that defaults such as userAdminAnyDatabase are gone, and you can view the roles through the show roles command.

# View role show roles#, view user show users

If you want to modify the user role, you can execute the db.updateUser command.

Db.updateUser ("admin", {roles: [{role: "readWrite", db: "xttblog"}, {role: "userAdmin", db: "xttblog"}, {role: "dbAdmin", db: "xttblog"}]})

After the operation is completed, we can modify the configuration file of mongo and turn on the authentication.

Vi / usr/local/etc/mongod.conf

Add the configuration after "# enable permission verification" at the end of the file.

SystemLog: destination: file path: / usr/local/var/log/mongodb/mongo.log logAppend: truestorage: dbPath: / usr/local/var/mongodbnet: bindIp: 127.0.0.1 port: 270 enable permission check security: authorization: enabled

Restart the service. Authentication is required to operate mongo again.

Mongouse xttblogdb.auth ("xttblog", "xttblog")

The same SpringBoot integration Mongo url will have to be configured with password authentication.

Mongodb://admin:admin@localhost:27017/xttblog thank you for reading this article carefully. I hope the article "how to fix the Error: No available formula with the name 'mongodb' problem of Mac brew installation mongodb newspaper" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report