Mongodb error: e query [thread1] syntax error: missing; before statement @(shell):1:4
March 27, 2019 22:55:53 zhangpeters read 544 more
Personal classification: mongodb
After installing mongodb at night and setting the password, if you directly connect to mongodb without password, you can connect to it, but you cannot switch to the specified database
-> # 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
The solution is to add a password when connecting:
-> # 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
Similar Posts:
- [Solved] Mongodb Error: NETWORK [thread1] Failed to connect to 127.0.0.1:27017
- Mongodb access control is not enabled for the database
- Mongodb Cannot Start: child process failed, exited with error number 100
- How to Solve MongoDB Error: Authentication failed.
- mongodb not authorized on admin to execute command [version 3.2.18]
- MongoDB Startup Error: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
- Error: couldn’t connect to server 127.0.0.1:27017
- Mongodb’s “not master and slave = false” error and its solution
- No package mongodb-org available. [How to Solve]
- mongoexport E QUERY SyntaxError: Unexpected identifier