Answer:
As you are using the database on the same machine of the application the connection configuration to the database can be changed to:
<?php
$HOST = 'localhost:3388';
$USER= '*****';
$PASS= '*****';
$BANCO = 'gclient_embratel';
$conexao = mysql_connect($HOST,$USER,$PASS) or die('Não foi possivel conectar: '.mysql_error());
$selecao = mysql_select_db($BANCO);?
?>
In place of the IP of your external machine defined in the variable $HOST
put the value localhost
, but could also be used 127.0.0.1
.
How much the refused connection can occur for several factors, being the main ones:
Mysql database service was not started and is not running on port 3388. If you use Linux you can do the command fuser 3388/tcp
to check if there is a process using this port.
Is there a restriction on your machine’s firewall to port 3388.
You are using a machine from Amazon Web Services
for your application? It is necessary to release the port in the security settings of your instance.
Putting the value localhost
in the variable $HOST
probably the options 2
and 3
are discarded because local machine port 3388 will be accessed without external access.
There may be several possibilities: 1 - The database server is not started on the machine (most likely), 2 - A firewall may be blocking access to the Mysql port.
– Giancarlo Abel Giulian