SQLSTATE[HY000] [2003] Can ' t connect to MySQL server on ' XXX ' (13)

Source: Internet
Author: User

SQLSTATE[HY000] [2003] Can ' t connect to MySQL server on ' XXX ' (13)
I can really see the problem of SELinux, and this question has made me look for a long time reason:
The result is that SELinux does not allow httpd to access the extranet, the Chrome browser was installed yesterday, the result does not allow the root account to run ....
SQLSTATE[HY000] [2003] Can ' t connect to MySQL server on ' XXX ' (13)
Workaround:
Selinux settings Can ' t connect to MySQL (13)


Connect local database successfully via PHP mysql_connect (' localhost ', ' usr ', ' pass ')
However, mysql_connect (' 127.0.0.1:3306 ', ' usr ', ' pass ') appears
Can ' t connect to MySQL server using ' (13) error
Reason:
#getsebool-A | grep httpd
[Email protected] phpmytest]$ 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_read_user_content--off
Httpd_setrlimit--off
Httpd_ssi_exec--off
Httpd_tmp_exec--off
Httpd_tty_comm-On
Httpd_unified--off
Httpd_use_cifs--off
HTTPD_USE_GPG--off
Httpd_use_nfs--off

Discover Httpd_can_network_connect-off

Solution:

#setsebool Httpd_can_network_connect 1

---------------------------------------------------------------------------------------

Linux server under can ' t connect to MySQL Server on ' (10060) (RPM)
The remote connection server has the above error, after resolving to make a summary, if there is a wrong, please correct me.

There are three main reasons:
1, the MySQL authorization table does not have the remote machine permission, and needs to add in the authorization form Mysql.user
Grant all privileges on * * to ' root ' @ ' remote login IP ' identified by ' Remote login password '
Flush privileges;

2, the network does not pass, this will not say.

3, firewall prohibit 3306 port, take iptable as an example
Vi/etc/sysconfig/iptables
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
Service Iptables Restart
Ps:iptables settings
1) effective after reboot
Open: Chkconfig iptables on
OFF: Chkconfig iptables off

2) immediate effect, failure after reboot
Open: Service iptables start
Close: Service iptables stop


Reprint please specify (B5 tutorial net) original link: http://www.bcty365.com/content-35-592-1.html reprint please indicate source original link: http://www.bcty365.com/content-35-592-1.html

SQLSTATE[HY000] [2003] Can ' t connect to MySQL server on ' XXX ' (13)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.