今天要连远程数据库,结果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. Redis常见用法

    using ServiceStack.Redis;using System;using System.Collections.Generic;using System.Linq;using Syste ...

  2. 精彩的解释CAP理论的文章

    强一致性(Consistency):  更新操作成功并返回客户端完成后,分布式的所有节点在同一时间的数据完全一致. 可用性(Availability):读和写操作都能成功. 分区容错性(Partiti ...

  3. 【译】微型ORM:PetaPoco【不完整的翻译】

    PetaPoco是一款适用于.Net 和Mono的微小.快速.单文件的微型ORM. PetaPoco有以下特色: 微小,没有依赖项……单个的C#文件可以方便的添加到任何项目中. 工作于严格的没有装饰的 ...

  4. keytool的使用

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

  5. Visual Studio的Web Performance Test提取规则详解(3)

    总结 Visual Studio的Web Performance Test是基于HTTP协议层的,它不依赖于浏览器,通过直接接收,发送HTTP包来和Web服务器交互.Web Performance T ...

  6. [转]C#读写TEXT文件

    1.使用FileStream读写文件 文件头: using System; using System.Collections.Generic; using System.Text; using Sys ...

  7. python os模块(1)

    os模块主要处理文件和目录(文件夹)的创建.删除.检查判定.属性值修改.路径修改. (1)获取当前目录的两种方法 1 os.getcwd() os.path.abspath('.') (2)创建文件夹 ...

  8. Codeforces Round #384 (Div. 2)A,B,C,D

    A. Vladik and flights time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  9. 学的一点点ps

    从C语言的代码中解脱开始学ps,看到色彩鲜明的东西,心里只有那么爽.哈哈.只学习3天,虽然只是一些皮毛,可还是学到了一些以前不知道的东西.让我对ps多了很多兴趣,决定以后要自学更多的ps技能.要给图片 ...

  10. Oracle_下载地址

    1.http://www.oracle.com/technetwork/cn/database/enterprise-edition/downloads/index.html 1.1.现在(20161 ...