diff --git a/docker-compose.yml b/docker-compose.yml index 66a7759..cbdaa8e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,7 +20,8 @@ services: MYSQL_DATABASE: teste_habilidade_php MYSQL_USER: root MYSQL_PASSWORD: 123456 - + networks: + - my_net networks: my_net: driver: bridge diff --git a/public/connection.php b/public/connection.php index bf6a7a7..8a6589a 100644 --- a/public/connection.php +++ b/public/connection.php @@ -3,11 +3,11 @@ $username = "root"; $password = "123456"; $database = "teste_habilidade_php"; -$host = "0.0.0.0"; +$host = "localhost"; $driver = "mysql"; try { - $connection = new PDO("{$driver}:dbname={$database};host={$host}:3307", $username, $password); + $connection = new PDO("{$driver}:host={$host}:3307;dbname={$database}", $username, $password); } catch(Exception $e){ echo "Não foi possível conectar ao banco de dados, verifique as informações de conexão no arquivo " . getcwd() . "/connection.php"; echo "
"; echo $e; echo "";