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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...