执行命令:

getsebool -a|grep httpd

发现 
httpd_can_network_connect off

解决: 

setsebool httpd_can_network_connect  && setsebool httpd_can_network_connect_cobbler  && setsebool httpd_can_network_connect_db  && setsebool httpd_can_network_relay 

需要重新启动httpd

systemctl restart httpd.service

 

centos7 centos中apache运行php需要连接mysql一直连不上,telnet访问mysql出错Connection closed by foreign host的更多相关文章

  1. XShell 连接虚拟机中的服务器 失败 、连接中断(Connection closed by foreign host.)

    在使用XShell连接虚拟机中的服务器时,报以下错误并断开连接,之前连接还是挺稳定的,忽然就这样了 Last login: Thu Aug :: from 192.168.1.102 [root@no ...

  2. xshell连接不了虚拟机处理方法(错误提示:Connection closing...Socket close.Connection closed by foreign host.Disconnected from remote host(localhost) at 08:47:23.)

    一.问题描述:xshell连接不了虚拟机,出现错误提示:Connection closing...Socket close.Connection closed by foreign host.Disc ...

  3. linux篇-xshell连接突然报Connection closed by foreign host.

    1问题描述报错 Connection closed by foreign host. Disconnected from remote host(yaoGS) at 155513. 2登入虚拟机 在l ...

  4. CentOS7.1 Xshell 经常掉线 Connection closed by foreign host

    XShell如果经常对CentOS掉线,则VNC肯定连接不上 但是ping CentOS的IP又能ping通,主要原因还是因为sshd的设置问题 #进入ssh目录 cd /etc/ssh #修改ssh ...

  5. CentOS7服务器中apache、php7以及mysql5.7的安装配置代码

    CentOS7服务器中apache.php7以及mysql5.7的配置代码如下所示: yum upgradeyum install net-tools 安装apache (http://m.86822 ...

  6. 【centOS】【xshell】xshell连接虚拟机上的centOS,操作途中突然断开连接,报错:connect closed by foreign host

    如题  xshell连接虚拟机上的centOS,操作途中突然断开连接,报错:connect closed by foreign host 快捷解决方法: 在虚拟机上centOS重新启动网络,即可解决问 ...

  7. Spring Boot连接MySQL长时间不连接后报错`com.mysql.cj.core.exceptions.ConnectionIsClosedException: No operations allowed after connection closed.`的解决办法

    报错:com.mysql.cj.core.exceptions.ConnectionIsClosedException: No operations allowed after connection ...

  8. centos中apache自用常用额外配置记录(xwamp)

    xwamp套件中apache配置,记录下,以免忘记. 配置路径 ${wwwroot_dir}/conf/httpd.conf 配置内容 <ifmodule mod_deflate.c> D ...

  9. CentOS中Apache虚拟主机(virtualHost)设置在/home目录下的若干问题

    在Ubuntu中安装LAMP是非常简单的意见事情.但是在CentOS中却遇到了很多问题. 首先是CentOS中必须手动配置iptables,把80端口开放出来,不然,是访问不到的,开放80端口在/et ...

随机推荐

  1. Python3面向对象——案例-01

    经典的策略模式案例 问题描述 使用"策略"设计模式处理订单折扣的 UML 类图 定义一系列算法,把它们一一封装起来,并且使它们可以相互替换.本模式使得算法可以独立于使用它的客户而变 ...

  2. MySql开启远程用户登录GRANTALLPRIVILEGESON*.*TO'root'@'%'I MySql开启远程用户登录GRANTALLPRIVILEGESON*.*TO'root'@'%'I

    MySql开启远程用户登录 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'huawei' WITH GRANT OPTION; FL ...

  3. 搞IT,算法编程不错的学习网址 & 一些专栏博客大神的地址(汇总)

    博客专栏大神 王晓华(算法的乐趣) 算法系列:http://blog.csdn.net/orbit/article/category/830251 PostgreSQL深入理解内核系列:http:// ...

  4. C# 格式化新招

    C# 格式化新招 ) from Attribute_Item where AttributeSysNo=$AttributeSysNo and Name='$Name' and SysNo !=$Sy ...

  5. mongodb crud

    //添加数据 db.users.insert({,"gender":"男"}); db.users.insert({"name":" ...

  6. Objective-C学习笔记(三)——用Objective-C编写第一个程序:Hello,World!

    不管是哪一个程序猿,或者是学习哪一门计算机语言.写的第一个程序基本上就是Hello World. 今天我们用OC来实现第一个程序:Hello World. 在Xcode中选择新建一个项目,在对话框中选 ...

  7. Reading privileged memory with a side-channel

    https://googleprojectzero.blogspot.jp/2018/01/reading-privileged-memory-with-side.html https://devel ...

  8. Linux shell命令 cp 加上-f还是提示是否覆盖

    这是由于环境变量中有 allias cp='cp -i' 为了去掉这个系统自带的别名,能够使用grep -r --include="*" "alias cp"  ...

  9. 微信小程序页面带参数跳转及接收参数内容navigator

    功能从index页面跳转到draw页面,并在draw页面获取id及imgUrl index.wxml <navigator class='looks-view' wx:for="{{i ...

  10. solr之定时增量索引实现

    solr本身就提供了一个工具库实现定时增量索引,但是我在使用的过程中发现会出现一些问题,目前遇到两点: 1.启动时总是报如下异常: ? 1 The web application [solr] reg ...