I can not connect to my Hostinger database. "(28000/1045): Access denied for user"

0

I have connection problems with external databases, this time I have tried to connect my app with Hostinger web hosting.

I have uploaded the php files, and when I tried the connection through Hurl.it it gives me everything ok:

GET http://gimcana.esy.es/consulta2.php?clau=246&titol_pista=eeii

   200 OK       2 bytes       348 ms

View Request View Response

 HEADERS
Content-Encoding: gzip
Content-Length: 22
Content-Type: text/html;charset=utf-8
Date: Tue, 06 Jun 2017 22:20:23 GMT
Server: Apache
Vary: Accept-Encoding
X-Powered-By: PHP/5.6.21
BODY

The php file that communicates with mysql in hostinger is:

function ejecutarSQLCommand($commando){
    $mysqli = new mysqli("mysql.hostinger.es", "usuario", "clave", "base");
                         //Estos datos los modifiqué al publicar acá

/* check connection */
if ($mysqli->connect_errno) {
    printf("Connect failed: %s\n", $mysqli->connect_error);
    exit();
}

if ( $mysqli->multi_query($commando)) {
    if ($resultset = $mysqli->store_result()) {
        while ($row = $resultset->fetch_array(MYSQLI_BOTH)) {

        }
        $resultset->free();
    }
}

By connecting to link I get the error:

  

Warning : mysqli :: mysqli (): (28000/1045): Access denied for user 'user'@'10.2.1.25' (using password: YES) in / home /u766633572/public_html/functions2.php on line 35

     

Connect failed: Access denied for user 'user'@'10.2.1.25' (using password: YES)

    
asked by Martí Amat Vila 07.06.2017 в 21:35
source

0 answers