



mysql -u user_MySQL_USER -p -h servername.massivehoster.comWelcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5921900
Server version: 10.11.9-MariaDB-cll-lve MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]><?php
// Fichier test-remote-mysql.php
$db_host = "servername.massivehoster.com"; // Server Hostname
$db_name = "user_MySQL_DB";
$db_user = "user_MySQL_USER";
$db_pass = "XXXXXXXXX";
$db_port = 3306; // Spécification du port
try {
$db = new PDO(
"mysql:host={$db_host};port={$db_port};dbname={$db_name}",
$db_user,
$db_pass,
array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
PDO::MYSQL_ATTR_LOCAL_INFILE => 1
)
);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connexion réussie !";
} catch (PDOException $e) {
echo "Erreur de connexion : " . $e->getMessage();
}
?>
mysql -u user_USER -p -h earth.massivehoster.comWelcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5921900
Server version: 10.11.9-MariaDB-cll-lve MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
