I tried to connect to a remote MySQL Server (192.168.1.197) from a server with IP 192.168.1.193.
My php connect:
$ Host = "192.168.1.197 ";
$ User = "root ";
$ Pass = "rootpassword ";
$ Database = "sample1 ";
# $ Con = @ mysql_connect ("$ host", "$ user", "$ pass") or die ('error connecting to mysql ');
$ Con = mysql_connect ("$ host", "username", "password") or die (mysql_error ());
$ Db = "$ Database"; @ mysql_select_db ($ db, $ con );
When I run this in the web, I'm getting the (13) error. I 've searched the web but cocould not find any concrete answer.
If I type this in the command prompt:
[Root @ localhost include] # mysql-u root-H 192.168.1.197-P
Enter password:
Welcome to the MySQL monitor. commands end with; or \ G.
Your MySQL connection ID is 71
Server version: 5.0.51a Source Distribution
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql>
I was able to connect ..
Can someone help me on this one?
I even created a user rights for root (both 193 & 197)
User host password global privileges Grant
Root 192.168.1.193 Yes All privileges Yes
Root 192.168.1.197 Yes All privileges Yes
Solution 1: setsebool-P httpd_can_network_connect_db = 1
Solution 2: Modify/etc/SELinux/config SELinux = enforcing to SELinux = disabled