UserNotFound mongodb error
You need to use

--authenticationDatabase admin

parameter...  Because, even you give &quot;use mydb&quot; before creating user...  User is created at the admin -database.
So,
mongo -u nameuser -p password  --authenticationDatabase admin localhost:12345/mydb