且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP MySQLi查询-& quot;权限被拒绝& quot;

更新时间:2021-08-11 19:45:24

我的环境中发生了同样的事情.原因是SELinux.

Same things happened on my environment. And the cause was SELinux.

您也许可以通过从命令行执行php来连接数据库 虽然您可能无法通过在Web服务器上执行.

You might be able to connect the database by executing php from command line while you might not by executing on the web server.

就我而言,我关闭了SELinux.

In my case, I turned off SELinux.

# setenforce 0

或者您必须正确设置SELinux.

Or you have to set up SELinux correctly.