Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to connect server database in php.
My configuration:
Webserver :- xampp
PHP       :- 7.3.3
OS        :- windows

it returns
mysqli::__construct(): (HY000/2002)
warning Error
What is solution for this error ?
why it occurs ?

What I have tried:

$dbServerName = "amazonaws.com";
$dbUsername = "example";
$dbPassword = "*******";
$dbName = "example";

// create connection
$conn = new mysqli($dbServerName, $dbUsername, $dbPassword, $dbName);

// check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
Posted
Updated 9-May-19 20:46pm

1 solution

What about the MySQL database on amazonaws? Did you create it? If so, the server name you have used should be a little more complicated than the one you provided (see Connecting to a DB Instance Running the MySQL Database Engine[^], and specifically the endpoint at the bottom of the document).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900