I am trying to login to mongodb database using mongodb shell, and if the password contains any special characters like -(hyphen) or '(single quote) , it gives error - Error parsing command line: unrecognised option '-8B'df5='.
mongo -u username -p -8B'df5= --authenticationDatabase admin
Kindly help
The manual for the deprecated
mongocommand makes it clear that the preferred way to pass a connection string is as a URI. https://docs.mongodb.com/manual/reference/connection-string/ makes it clear that usernames and passwords can be passed as part of that URI.%27is the URL-escaping version of'%3Dis the URL-escaping version of=Python's
urllib.quote()is one of the many ways you can look up these mappings yourself.