konfused Posted June 13, 2017 Share Posted June 13, 2017 From several of Larry Ullmann’s books in 2013 I was able to create 8 successful databases using XAMPP. On one of my Windows 10 computers I downloaded the latest version 7 of XAMPP for PHP7 and MySQL 8 and I am no longer able to run databases because of the following error message: Could not connect to MySQL: Access denied for user 'horatio'@'localhost' (using password: YES) I assume that my 2012 code is now out of date. I would be most grateful if you would let me know what the code should now be. In 2013 the successful mysqli_connect.php code was as follows: <?php // This provides the information for accessing the database. DEFINE ('DB_USER', 'horatio'); DEFINE ('DB_PASSWORD', 'hmsvictory'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'simpleIdb'); // Make the connection: $dbcon = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() ); // Set the encoding... mysqli_set_charset($dbcon, 'utf8'); ?> The page that interacts with mysqli_connect.php contains the following linking code: if (empty($errors)) { // If everything's OK. // Register the user in the database... require ('./mysqli_connect.php'); // Connect to the db. I am able to create datebases and tables using the latest phpmyadmin included in XAMPP 7. Link to comment Share on other sites More sharing options...
Larry Posted June 14, 2017 Share Posted June 14, 2017 It's just a matter of using the right password/user combination. I think XAMPP uses "root" and "password" but you can check their documentation to confirm. Link to comment Share on other sites More sharing options...
fuzzybutt Posted August 3, 2017 Share Posted August 3, 2017 Hey, I ran into the same problem when I was setting everything up. I searched alot and this one seemed to work, also did that "flush privileges" thing (super noob so this book is my first for learning MySQL and PHP) and also found this site useful https://www.ostraining.com/blog/coding/error-1045-phpmyadmin/ Link to comment Share on other sites More sharing options...
Larry Posted October 3, 2017 Share Posted October 3, 2017 Ooooo, I have not seen that one in a while. What versions of PHP and MySQL are you using? On what OS? How did you install them? Link to comment Share on other sites More sharing options...
Recommended Posts