Reputation: 51
I want to connect to database with ip address instead of local host, but when I write IP Address (another PC in LAN), it shows me error of permission denied.My connection array is as follows:
$db['default']['hostname'] = '192.168.1.122';
$db['default']['username'] = 'root';
$db['default']['password'] = '123456';
$db['default']['database'] = 'test_db';
$db['default']['dbdriver'] = 'mysqli';
result is:
Message: mysqli::real_connect(): (HY000/2002): Permission denied Filename: mysqli/mysqli_driver.php
I am using CentOS 7 and tried connection with telnet and it is working fine there.
Upvotes: 0
Views: 2104
Reputation: 470
I had the same issue and found the solution to be that Apache was not set to allow remote connections.
You can run this to check:
getsebool -a | grep httpd_can_network
I ran the following to fix the issue:
sudo setsebool -P httpd_can_network_connect 1
sudo setsebool -P httpd_can_network_connect_db 1
Source:
Upvotes: 0