how can I connect to a remote mongo server from Mac OS terminal



  • 2 Answer(s)

    May be You are connecting fine but don’t have sufficient privileges to run show dbs.

    You don’t want to execute the db.auth if you pass the auth in the command line:

    mongo somewhere.mongolayer.com:10011/my_database -u username -p password
    
    

    you able to see the collections for, when your connect

    > show collections
    
    

    If so all is good and you don’t have admin prerogative to the database and can’t execute the show dbs

    Answered on January 11, 2019.
    Add Comment

    For Mongo 3.2 and higher use your connection string as is:

    mongo mongodb://username:[email protected]:10011/my_database
    
    
    Answered on January 11, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.