Jump to content
Larry Ullman's Book Forums

Could Not Connect To Mysql


Recommended Posts

Hi there,

In Chapter 8, Using PHP with MySQL, I get this answer:

Could not connect to MySQL: Access denied for user 'username'@'localhost' (using password: YES)

after clicking on the 'View Users' tab. Can anyone help me?

Link to comment
Share on other sites

Hi,

Here's the mysqli_connect.php file code:

 

<?php # Script 8.2 - mysqli_connect.php
DEFINE ('DB_USER', 'username');
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'sitename');
$dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() );
?>

 

I get the same answer after trying to register a user via the register form. Maybe it is something wrong with MySQL connection...

Link to comment
Share on other sites

 Share

×
×
  • Create New...