Jump to content
Larry Ullman's Book Forums

Recommended Posts

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

  • 1 month later...
  • 1 month later...
 Share

×
×
  • Create New...