0

Here is how I am trying to connect to my database and the errors it gives

<?php
$host= 'http://website.com/';
//Error: Unable to connect to MySQL. Debugging errno: 2005 Debugging error: 
//Unknown MySQL server host 'http://website.com/' (-2)

//$host= 'localhost';
//Error: Unable to connect to MySQL. Debugging errno: 0 Debugging error:

//$host= 'website_ip';
//Error: Unable to connect to MySQL. Debugging errno: 1045 Debugging error: 
//Access denied for user 'website_user'@'website_ip' (using password: 
 YES)

$username= 'website_user';//user i created for db and granted all privileges
$password= 'password';//password  for that user
$database= 'website_database';//database i created
//$port= '3306'; Don't know if i should use this or not, tried with and 
without, no difference

$konekcija = mysqli_connect($host, $username,$password, $database, //$port);
mysqli_query($konekcija, "SET NAMES UTF8");
if (!$link) {
    echo "Error: Unable to connect to MySQL." . PHP_EOL;
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
    exit;
}
?>

Password is correct, tripple checked.

Tried php5.6, php7.0 and php7.1

UC3D
  • 383
  • 1
  • 3
  • 10

0 Answers0