SQLSTATE[HY000] [2003] Can't connect to MySQL server on '127.0.0.1' (13)
通过php的mysql_connect('localhost','usr','pass')连接本地数据库成功,但是,mysql_connect('127.0.0.1:3306','usr','pass')出现Can't connect to MySQL server on '127.0.0.1' (13)的错误。
解决方法:
getsebool -a | grep httpd
[root@centos ~]# 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_dbus_sssd --> off 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_preupgrade --> 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
解决方法:
setsebool httpd_can_network_connect 1
参考链接:https://www.cnblogs.com/Darlin356230410/p/4506207.html
« Scala学习笔记
|
高并发下余额扣减一致性问题»