Here is my code:
<?php
$servername = "127.0.0.1";
$username = "root";
$password = "";
$dbname = "website";
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
try {
$dbh = new PDO('mysql:host=127.0.0.1;dbname=website', $username, $password);
/*$stmt = $dbh->prepare('SELECT * FROM USERS WHERE Username = :name');
$stmt->bindParam(':name', $name, PDO::PARAM_STR, 24);
$name = "andrei";
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
print_r($result['Username']);
$dbh = null;*/
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>
And this is the error:
Error!: SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
I don't understand what is the issue... the database name is spelt right, I double checked and if it is needed I can even post a screenshot of the phpmyadmin...
EDIT
I see that in phpmyadmin
Server type: MariaDB
how can I change that to mysql?