My centos 7 phpMyAdmin unable to connect to remote database as i think the security policy is not allowing it (port may be disabled by firewall). As i checked the same configuration on wamp phpmyadmin its able to connect with same entry in config.inc.php. Can anyone tell on which port phpMyAdmin send request for connecting remote database so that i can enable it in centos 7 firewall.
-
`firewall-cmd --zone=MyZone --add-service=mysql` – Michael Hampton Dec 30 '16 at 06:48
-
i have already did it. `sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent` – antoniomerlin Dec 30 '16 at 07:32
3 Answers
The default port for MySQL is 3306.
A database server (such as MySQL) is the one actually running databases and queries. phpMyAdmin is simply a utility to manage the server. Make sure the service is actually runnung.

- 85
- 2
- 9
-
i have already did it. `sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent` still not able to connect – antoniomerlin Dec 30 '16 at 07:32
The server's firewall blocks your ip on port 3306 (as Brandon said the default port for MySQL). I recommend you to verify the communication by using putty or telnet and see if you can actually open a connection.
telnet mysqlhost 3306
MySQL simply doesn't allow remote connections for your username. You should be able to verify this by using :
mysql -h host -u user -p

- 470
- 1
- 6
- 20
-
I've did that and verify it using telnet it's show connected and then Host is not allowed to connect to this MySQL serverConnection closed by foreign host. – antoniomerlin Dec 30 '16 at 08:30
-
To make sure did you replace ''host'' and ''user'' with the correct values for your Mysql? – Alexandre Roux Dec 30 '16 at 08:43
-
Also during the installation did you secure your MySQL by using : sudo mysql_secure_installation – Alexandre Roux Dec 30 '16 at 08:44
-
-
Ok cool, so now could you open a mysql connection using your root user? – Alexandre Roux Dec 30 '16 at 09:00
-
yup i can but just the problem i am facing is to connect server phpmyadmin to a remote database. – antoniomerlin Dec 30 '16 at 09:01
-
I'm sorry but do you mean that from your Centos 7 you cannot : mysql -h remoteDatabaseHost -u root -p? – Alexandre Roux Dec 30 '16 at 09:12
-
yes as i using same config.inc.php on both machine windows its working but in centos 7 it;s not i think this PHP MySQL library version 5.6.31 differs from your MySQL server version 5.7.17 causing the error. – antoniomerlin Dec 30 '16 at 17:05
Finally i got the solution due to this link post First i unistalled php5.4 and upgraded it to 7 then i removed phpmyadmin 4.4 and upgraded it with 4.6 (As i don't have option to disable selinux policy) still i a
mysqli_connect(): (HY000/2002): Permission denied configure local socket
i've run these command from post:-
setsebool httpd_can_network_connect on
setsebool httpd_can_network_connect_db on
setsebool mysql_connect_any on
restarted apache and mysql hola i got connection. Thanks to all for replying and helping me out.

- 121
- 1
- 1
- 4