且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Golang和MongoDB远程访问失败(服务器上的SASL身份验证步骤返回的错误:验证失败。)

更新时间:2021-07-12 17:20:12

请检查您是否添加了用户为你的Mongolab数据库实例(的 https://mongolab.com/databases/catalog#users 的情况下,如果你的数据库名称是目录),因为默认情况下,你的用户列表为空(帐号用户名/密码!=数据库用户名/密码)。

Please check if you have added users for your Mongolab database instance (https://mongolab.com/databases/catalog#users in case if your DB name is catalog) because by default your users list is empty (account user/password != database user/password).

另外补充 /<数据库名称> 来连接字符串的结尾 - 的mongodb:// *******:* ****** @ ds045795.mongolab.com:45795/databasename

Also add /<databasename> to the end of your connection string - mongodb://*******:*******@ds045795.mongolab.com:45795/databasename.