Jump to content
Sign in to follow this  
PHPremote

mysqli connect fails with correct parameters

Recommended Posts

The following standard code is not allowing access to the MySQL database indicated:

	// declare database validation variables
	$servername = "localhost";
	$username = "toughnerd";
	$password = "frustrated";
	$dbname = "workforaliving2";

	// Create connection
	$conn = new mysqli($servername, $username, $password, $dbname);

	// Check connection
	if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
	}
		echo "Connected successfully";

Here is the error message:

Quote

Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'toughnerd'@'localhost' (using password: YES) in C:\xampp\htdocs\frameworkinphpsauce\testingOfFramework\askQuery_function.php on line 43
Connection failed: Access denied for user 'toughnerd'@'localhost' (using password: YES)

The server name, username, password, and database name are correct, defined in phpAdmin as needed.

I do understand that "(using password: YES)" just means a password is being used.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...