golang 连接 mongodb dial 报错 server returned error on SASL authentication step: Authencication failed.
2016-12-22 16:18
2636 查看
问题:server returned error on SASL authentication step: Authencication failed.
思路:解决这个问题,要看go语言的文档https://godoc.org/gopkg.in/mgo.v2#Dial
The username and password provided in the URL will be used to authenticate into the database named after the slash at the end of
the host names, or into the "admin" database if none is provided. The authentication information will persist in sessions obtained through the New method as well.
在URL中提供的用户名和密码将被用来对名为“斜杠”的数据库进行认证,如果没有提供的话,将被命名为“admin”数据库。验证信息将坚持通过新方法获得的会话以及。
原来是配置的问题:
"mongoAddr": "username:password@port/databasename",
这里要把/databasename加上,否则默认的数据库是 admin,导致SASL鉴权失败。
思路:解决这个问题,要看go语言的文档https://godoc.org/gopkg.in/mgo.v2#Dial
The username and password provided in the URL will be used to authenticate into the database named after the slash at the end of
the host names, or into the "admin" database if none is provided. The authentication information will persist in sessions obtained through the New method as well.
在URL中提供的用户名和密码将被用来对名为“斜杠”的数据库进行认证,如果没有提供的话,将被命名为“admin”数据库。验证信息将坚持通过新方法获得的会话以及。
原来是配置的问题:
"mongoAddr": "username:password@port/databasename",
这里要把/databasename加上,否则默认的数据库是 admin,导致SASL鉴权失败。
相关文章推荐
- Failed: error connecting to db server: server returned error on SASL authentication step: Authentica
- HttpWebRequest WebExcepton: The remote server returned an error: (407) Proxy Authentication Required.
- 用Navicat连接Oracle数据库时报错ORA-28547:connection to server failed, probable Oracle Net admin error
- unable to start debugging on the web server. An authentication error occurred while communicating with the web server.
- MongoDB not authorized on admin to execute command --auth Authentication failed.
- in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
- navicat连接oracle数据库报ORA-28547: connection to server failed, probable Oracle Net admin error错误的解决方法
- MySQL远程连接ERROR 2003 (HY000):Can\'t connect to MySQL server on\'XXXXX\'的问题
- mongodb Failed: error connecting to db server: no reachable servers
- The server returned the following error: 无法与服务器建立连接(0x80072EFD)
- Error:svn: E175002: connection refused by the server svn: E175002: OPTIONS request failed on '
- Rails 之微信开发 : OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
- SMTP server rejected auth: 535 Error: authentication failed Gerrit 认证邮箱报错
- vs 2008 sp1 - Unable to start debugging on web server. An authentication error occurred...
- gem sources -a https://ruby.taobao.org/ 提示:Error fetching https://ruby.taobao.org/ SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: ce rtificate verify failed
- linux上svn连接visual svn server时ssl鉴权失败,问题解决 SSL handshake failed: SSL error: Key usage violation in ce
- ASP.Net DebugError解决方案[转]:Unable to start debugging on the web server.Debugging failes because integrated Windows authentication is not enabled.
- EWS code return Error : Request failed. The remote server returned an error: (403) Forbidden OR (401) Unauthorized
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
- navicat连接oracle数据库报ORA-28547: connection to server failed, probable Oracle Net admin error错误的解决方法