Juan Posted February 21, 2013 Share Posted February 21, 2013 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 More sharing options...
HartleySan Posted February 21, 2013 Share Posted February 21, 2013 Most likely your mysqli_connect function call code is incorrect. If you don't mind, please post the relevant code (and remove/mask your real login info within the function call so we don't see it). Thanks. Link to comment Share on other sites More sharing options...
Juan Posted February 22, 2013 Author Share Posted February 22, 2013 Hi, Here's the mysqli_connect.php file code: <?php # Script 8.2 - mysqli_connect.phpDEFINE ('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 More sharing options...
Larry Posted February 22, 2013 Share Posted February 22, 2013 Have you created a "username" user with a "password" password in MySQL? Link to comment Share on other sites More sharing options...
HartleySan Posted February 22, 2013 Share Posted February 22, 2013 Is your user name actually "username"? Is your password actually "password"? If not, then you need to fill in the actual values. Note that those values are meant to serve as placeholders, not be the actual values. Link to comment Share on other sites More sharing options...
Juan Posted February 22, 2013 Author Share Posted February 22, 2013 There is the sitename database with 12 user examples from chapter 5. Link to comment Share on other sites More sharing options...
Juan Posted February 22, 2013 Author Share Posted February 22, 2013 Yeah, I've got it. I didn't create a user with a 'password' in MySQL, so that was it. Thank you so much! Link to comment Share on other sites More sharing options...
Recommended Posts