我有一个非常奇怪的情况,涉及phpMyAdmin尝试连接到远程数据库服务器。请注意,所有计算机都运行CentOS 7。
以下是我目前的情况:
'root'@'%'
登录的mariadb 10.2服务器。 这是我的/etc/phpMyAdmin/config.inc.php,删除了个人信息
$i = 0;
$i++;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'mypass';
$cfg['Servers'][$i]['host'] = '1.2.3.4';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
以下是phpMyAdmin向我展示的错误:
#2002 - Permission denied — The server is not responding (or the local server's socket is not correctly configured)
mysqli_real_connect(): (HY000/2002): Permission denied
我已经在本地client2机器上重新安装了mariadb,并在config.inc.php中手动设置套接字值,但这似乎没有任何修复。
即使phpMyAdmin失败,以下命令也可以从Client2机器上正常连接:
mysql -u root -h 1.2.3.4 -pmypass
我现在还不确定如何缩小搜索范围。
答案 0 :(得分:0)
答案是愚蠢但很简单,SElinux是问题,而不是在数据库服务器上,而是在客户端。
在客户端,您可以运行:
getsebool -a | grep httpd_can_network_connect_db
我收到了回复:
httpd_can_network_connect_db --> off
要更改它,您可以运行:
setsebool -P httpd_can_network_connect_db on
一旦我完成了phpMyAdmin立即连接页面刷新。
我不知道SELinux会阻止传出连接:(