Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

安装了1.8.5版本,普通用户无法查询数据。超级管理可以 #85

Open
lepig opened this issue Nov 14, 2018 · 1 comment
Open

Comments

@lepig
Copy link

lepig commented Nov 14, 2018

我用的是ThinkPHP5.0.22.
我在extra目录下建立了一个文件叫mongo.php内容如下

return [
    'type'          =>   '\think\mongo\Connection',
    'hostname'      =>   '1.2.3.4',
    'database'      =>   'fa_brand',
    'username'      =>   'mongodb',
    'password'      =>   'pre-mongodb',
    'hostport'      =>   '2000',
    'prefix'        => '',
    'pk_convert_id' => true,
    'debug'         => false,
];

这样配置了以后,查询数据报

not authorized on fa_brand to execute command { find: "brand_user", filter: {}, projection: {}, limit: 0 }

但是我使用mongodb这个用户通过命令行是可以查询出来的。

最后我把username这个用户换成了超级管理员,却可以查询出来。 很奇怪啊 。

@lepig
Copy link
Author

lepig commented Nov 14, 2018

好吧。最终测试了是因为用了mongodb这个特殊的用户名。我让dba重新给我开了个别的用户名发现可以了。
这也是个坑,希望后面的同学可以看到这个issue。不要踩坑了。

补充: 因为这个特殊的用户名,java同事那边一直在用,没什么问题。所以dba直接让我们一起用的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant