database connect failed!Can't connect to MySQL server on '127.0.0.1' (13)
2014-06-10 09:21
1046 查看
php链接数据库,出现如下错误
database connect failed!Can't connect to MySQL server on '127.0.0.1' (13)
解决办法:
[root@localhost ~]# 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_serve_cobbler_files --> 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_fusefs --> off
httpd_use_gpg --> off
httpd_use_nfs --> off
httpd_use_openstack --> off
httpd_verify_dns --> off
所以,执行如下命令,ok
[root@localhost ~]# setsebool httpd_can_network_connect 1
database connect failed!Can't connect to MySQL server on '127.0.0.1' (13)
解决办法:
[root@localhost ~]# 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_serve_cobbler_files --> 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_fusefs --> off
httpd_use_gpg --> off
httpd_use_nfs --> off
httpd_use_openstack --> off
httpd_verify_dns --> off
所以,执行如下命令,ok
[root@localhost ~]# setsebool httpd_can_network_connect 1
相关文章推荐
- MySQL 数据库连接失败 SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (13)
- Can't connect to MySQL server on '127.0.0.1' (13)
- Can’t connect to MySQL server on ‘…’ (13)
- [mysql] Can't connect to mysql server on '127.0.0.1'
- 执行廖雪峰老师案例时出现的问题【pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1'"】
- Mysql 连接报错 Can't connect to MySQL server on “127.0.0.1” (61)
- MySQL workbench的Can't connect to MySQL server on '127.0.0.1'(10061)
- can not connect to MySQL server on "10.30.48.153"(13)
- 远程连接CentOS的MySQL报错:Can't connect to MySQL server on 'XXX' (13)
- Ruby—Mysql2::Error: Can't connect to MySQL server on '127.0.0.1' (61)
- Can't connect to MySQL server on 'ip' (13)
- mac Can't connect to MySQL server on '127.0.0.1' (61)
- Python报错-(2003 Can t connect to MySQL server on 127.0.0.1)
- Can't connect to MySQL server on 'ip' (13)
- 2003-Can't connect to MySQL server on '127.0.0.1' (10038)
- 终于解决 Can't connect to MySQL server on '127.0.0.1' (10061) (2003)
- MySQL---can't connect to MySQL server on '127.0.0.1'(1006)
- Ubuntu ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
- 远程连接CentOS的MySQL报错:Can't connect to MySQL server on 'XXX' (13)
- SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'XXX' (13)