kaz123 Posted June 1, 2014 Share Posted June 1, 2014 Hi, I was working on the example "Message Board" on chapter 17, but I can't connect to the database. I am getting the following error "Could not connect to MySQL: Access denied for user 'username'@'localhost' (using password: YES)" I am using XAMPP. Any help will be appreciated. Link to comment Share on other sites More sharing options...
Antonio Conte Posted June 2, 2014 Share Posted June 2, 2014 Double check your username and password. As simple as that. It's often 'root' (username) and '' (no password) for the standard XAMPP setup. If it's not obvious, you need to change the info in mysql(i)_connect() to match your own DB user credentials. Link to comment Share on other sites More sharing options...
Larry Posted June 2, 2014 Share Posted June 2, 2014 And if you want to use "username", you'll need to create that in MySQL, and then flush the privileges. Link to comment Share on other sites More sharing options...
Cardbeagle Posted July 18, 2014 Share Posted July 18, 2014 Obviously, I am a novice at this. I created a password for the root user and added another user "Rick" with a password. I changed the host in the config file from 127.0.0.1 to localhost. I saved the file s mysqli_test.php with the exact text in the example since I am not sure what needs to be changed. <?php mysqli_connect ('localhost', 'webuser', 'BroWsIng', 'temp'); ?> Warning: mysqli_connect(): (HY000/1045): Access denied for user 'webuser'@'localhost' (using password: YES) in C:\xampp\htdocs\mysqli_test.php on line 3 Link to comment Share on other sites More sharing options...
Larry Posted July 18, 2014 Share Posted July 18, 2014 You'll need to change the username, password, and database arguments (the second through fourth) to being ones that are actually valid. Link to comment Share on other sites More sharing options...
Cardbeagle Posted July 19, 2014 Share Posted July 19, 2014 Got it. Thanks for your help. I missed the instructions in the appendix to create the "temp" db. Got it confused with "test" which was already there. Link to comment Share on other sites More sharing options...
Recommended Posts