Remote Connection to DBA MYSQL + PHP

Asked

Viewed 126 times

0

Hello I’m trying to make a test connection to a server called *

infinityfree

I’m using php with PDO. Call for connection.

 <?php 


try {
    $connex = new PDO("mysql:host=sql206.epizy.com;dbname=epiz_21864346_controle_estoque","epiz_21864346","kuNg2kQjR8XR");
      $connex->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  } catch(PDOException $e) {
      echo 'ERROR: ' . $e->getMessage();
  }

Detail of the server I am using

inserir a descrição da imagem aqui

Error that is returning me

inserir a descrição da imagem aqui

Can someone help me ?

  • Could be a firewall, and I think you need to specify the service port

  • Remove your password from the example

  • Tend to connect from the command line Mysql client, so you can know if the problem is PHP-specific or not.

  • Sometimes the host blocks general, and has to release the IP that is trying to access.

1 answer

0

You need to add your IP to the list of remotes allowed to connect to that database.

If the control panel is cPanel is in this icon: inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.