mongodb報錯:E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:4

mongodb報錯:E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:4

2019年03月27日 22:55:53 zhangpeterx 閱讀數 544更多mongodb

我的分類: mongodbshell

晚上在安裝mongodb,設置密碼後,若是直接鏈接mongodb,不用密碼,雖然能夠連上,可是會沒法切換到指定數據庫:數據庫

-> # mongo                            
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.3
> 1+1
2
> ues admin
2019-03-27T22:42:21.838+0800 E QUERY    [thread1] SyntaxError: missing ; before statement @(shell):1:4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

解決方法是鏈接時加上密碼:spa

-> # mongo --port 27017 -u "myUserAdmin" -p "abc123" --authenticationDatabase "admin"
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017/
MongoDB server version: 3.6.3
> use test
switched to db test
相關文章
相關標籤/搜索