ClickHouse/docker/test/integration/mysql_php_client/test_ssl.php
Ilya Yatsishin e6420c82ca
mysql/postgresql: move Dockerfiles and docker_compose to docker/test (#13448)
* mysql/postgresql: move Dockerfiles and docker_compose to docker/test
* Build client containers in CI
* pass tag to docker_compose
2020-08-12 18:04:36 +03:00

28 lines
728 B
PHP

<?php
$host = $argv[1];
$db = "system";
$user = $argv[3];
$pass = $argv[4];
$charset = "utf8mb4";
$port = $argv[2];
$dsn = "mysql:host=$host;port=$port;dbname=$db;charset=$charset";
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::MYSQL_ATTR_DIRECT_QUERY => true,
PDO::MYSQL_ATTR_SSL_CERT => "client.crt",
PDO::MYSQL_ATTR_SSL_KEY => "client.key",
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => 0,
];
$pdo = new PDO($dsn, $user, $pass, $options);
$stmt = $pdo->query("SELECT name FROM tables WHERE name = 'tables'");
foreach ($stmt as $row)
{
echo $row["name"] . "\n";
}
?>