今天要连远程数据库,结果PHP报错

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on '192.168.1.252' (13)' in /web/miophp/Etc/geter/Action/IndexAction.php:7 Stack trace: #0 /web/miophp/Etc/geter/Action/IndexAction.php(7): PDO->__construct('mysql:dbname=ba...', 'mio', 'miomio', Array) #1 /web/miophp/Etc/geter/Action/Action.php(11): IndexAction->index() #2 [internal function]: Action->ActionInit('index') #3 /web/miophp/Core/core.php(36): call_user_func(Array, 'index') #4 /web/miophp/Mio.php(30): include('/web/miophp/Cor...') #5 /web/admin/mio/index.php(20): require('/web/miophp/Mio...') #6 {main} thrown in /web/miophp/Etc/geter/Action/IndexAction.php on line 7

我以为是程序有问题 查了半天结果是selinux

[root@mio-253 ~]# getsebool -a | grep httpd

allow_httpd_anon_write --> off

allow_httpd_mod_auth_ntlm_winbind --> off

allow_httpd_mod_auth_pam --> off

allow_httpd_sys_script_anon_write --> off

httpd_builtin_scripting --> on

httpd_can_check_spam --> off

httpd_can_network_connect --> off

httpd_can_network_connect_cobbler --> off

httpd_can_network_connect_db --> off

httpd_can_network_memcache --> off

httpd_can_network_relay --> off

httpd_can_sendmail --> off

httpd_dbus_avahi --> on

httpd_enable_cgi --> on

httpd_enable_ftp_server --> off

httpd_enable_homedirs --> off

httpd_execmem --> off

httpd_manage_ipa --> off

httpd_read_user_content --> off

httpd_run_stickshift --> off

httpd_setrlimit --> off

httpd_ssi_exec --> off

httpd_tmp_exec --> off

httpd_tty_comm --> on

httpd_unified --> on

httpd_use_cifs --> off

httpd_use_gpg --> off

httpd_use_nfs --> off

httpd_use_openstack --> off

httpd_verify_dns --> off

[root@mio-253 ~]# setsebool -P httpd_can_network_connect_db=1

SQLSTATE[HY000] [2003] Cant connect to MySQL server的更多相关文章

  1. ERROR 2003 (HY000): Can't connect to MySQL server on 'ip address' (111)的处理办法

    远程连接mysql数据库时可以使用以下指令 mysql -h 192.168.1.104 -u root -p 如果是初次安装mysql,需要将所有/etc/mysql/内的所有配置文件的bind-a ...

  2. mysql绿色版安装问题解决(ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061))

    原来一直是使用MySQL安装版没有出现过问题,今天在安装绿色版MySQL时出现了点问题 在安装成windows服务成功后,用net start mysql 启动时提示启动成功,但当我连接mysql就报 ...

  3. 【linux错误解决】MySQL远程连接ERROR 2003 (HY000):Can't connect to MySQL server on'XXXXX'的问题

    问题描述: 从一台linux远程连接另一台linux上的MySQL, 出现ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.x ...

  4. ERROR 2003 (HY000): Can't connect to MySQL server

    http://blog.csdn.net/longxibendi/article/details/6363934 一.问题的提出 /usr/local/webserver/mysql/bin/mysq ...

  5. ERROR 2003 (HY000): Can't connect to MySQL server on 'ip'(111)

    问题描述:  从一台linux远程连接另一台linux上的MySQL, 出现ERROR 2003 (HY000): Can't connect to MySQL server on 'ip'(111) ...

  6. (一)MYSQL ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.10.210' (111) 解决方法

    今天在测试MySQL的连接时候,发现连接不通过,并报错ERROR 2003 (HY000): Can't connect to mysql server on '192.168.10.210' (11 ...

  7. MYSQL ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.10.210' (111) 解决方法

    今天在测试MySQL的连接时候,发现连接不通过,并报错ERROR 2003 (HY000): Can't connect to mysql server on '192.168.10.210' (11 ...

  8. ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061),mysql服务已启动

    1 前言 在mysql服务已启动,用命令行进入或者heidisql工具都提示ERROR 2003 (HY000): Can't connect to MySQL server on 'localhos ...

  9. [转]MySQL远程连接ERROR 2003 (HY000):Can't connect to MySQL server on'XXXXX'(111) 的问题

    问题描述: 从一台Linux远程连接另一台linux上的MySQL, 出现ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.x ...

随机推荐

  1. [selector1][selector2][selectorN]

    复合属性选择器,需要同时满足多个条件时使用. 描述: 找到所有含有 id 属性,并且它的 name 属性是以 man 结尾的 HTML 代码: <input id="man-news& ...

  2. 为您详细比较三个 CSS 预处理器(框架):Sass、LESS 和 Stylus

    CSS 预处理器技术已经非常的成熟,而且也涌现出了越来越多的 CSS 的预处理器框架.本文向你介绍使用最为普遍的三款 CSS 预处理器框架,分别是 Sass.Less CSS.Stylus. 首先我们 ...

  3. Java判断访问设备为手机、微信、PC工具类

    package com.lwj.util; import javax.servlet.http.HttpServletRequest; /** * 判断访问设备为PC或者手机--工具类 * * @de ...

  4. if 语句运用

    运用if语句完成对年.月.日的判断. Console.WriteLine("其输入年份:"); int a = int.Parse(Console.ReadLine()); Con ...

  5. keytool的使用

    1. 创建数字证书 keytool -genkey -v -alias scent -dname "CN=John,OU=MNG,O=Corp,L=Hangzhou,ST=Zhejiang, ...

  6. Android Fragment 真正的完全解析(上)

    转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/37970961 自从Fragment出现,曾经有段时间,感觉大家谈什么都能跟Fra ...

  7. [问题2014S11] 解答

    [问题2014S11]  解答 我们先引用一下复旦高代书 P310 的习题 6, 其证明可参考白皮书 P257 的例 8.33: 习题6  设实二次型 \(f(x_1,x_2,\cdots,x_n)= ...

  8. 18.ssh远程双向无密码登陆

    #ssh远程双向无密码登陆 需求:在192.168.10.100执行ssh 192.168.20.205不需要输入密码直接跳转到205机器 #在192.168.10.100执行命令,我这里使用root ...

  9. Java中Object类

    Object类是所有类的父类,如果一个类没有使用extends关键字明确标识继承另一个类,那么这个类默认继承Object类. Object类中的方法,适合所有子类. Object中的几个重要方法: 1 ...

  10. remount failed: Operation not permitted ,怎么办呢?

    remount failed: Operation not permitted ,怎么办呢? 1. 确定是否正确连接手机了$ adb devices 2. 进入shell$ adb shell 3. ...