hfcnew Posted April 5, 2018 Share Posted April 5, 2018 I'm currently at step 5 on p.440. I got the "Enter password" prompt, but when I entered a password, I got the following response: ERROR 1045 <28000>: Access denied for user 'root'@'localhost' <using password: Y ES> It was really weird the way it was cut off like that. But try as I might, I could only expand the command prompt window vertically, not horizontally. So I'm not 100% sure what the messages are. So I tried using "yes" as a password and got this response: ERROR 1045 <28000>: Access denied for user 'root'@'localhost' <using password: N O> What am I doing wrong? Link to comment Share on other sites More sharing options...
Larry Posted April 6, 2018 Share Posted April 6, 2018 Sorry for the confusion here! I wouldn't worry at all about the "YES" being wrapped like that. It's just a matter of the size of the terminal window and has no impact on the functionality. I'm not sure what's going on the second time. Do you know what the proper MySQL password is? It's almost certainly not "yes". Link to comment Share on other sites More sharing options...
hfcnew Posted April 7, 2018 Author Share Posted April 7, 2018 Do you know what the proper MySQL password is? It's almost certainly not "yes". That part isn't clear to me. I thought this was where I was setting up the password. If there's already a password, where do I go to find out what it is? Link to comment Share on other sites More sharing options...
Larry Posted April 9, 2018 Share Posted April 9, 2018 Depending upon how you installed MySQL and on what operating system, there may or may not be a password set already. Earlier you specifically referenced page 440, and the steps there are just logging into MySQL. They aren't trying to set the password. Link to comment Share on other sites More sharing options...
hfcnew Posted April 12, 2018 Author Share Posted April 12, 2018 (edited) I'm actually on p.350. It said something about testing connection username and password by using them in the MySQL client, which I thought was a reference to p. 438. Anyhow, this is my code for mysqli_connect.php: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Connect to MySQL</title> </head> <body> <?php // Script 12.1 - mysqli_connect.php /* This script connects to the MySQL database. */ // Attempt to connect to MySQL and print out messages: if ($dbc = mysqli_connect('localhost', 'username', 'password', 'myblog')) { print '<p>Successfully connected to the database!</p>'; mysqli_close($dbc); // Close the connection. } else { print '<p style="color: red;">Could not connect to the database.</p>'; } ?> </body> </html> But when I bring up its page, I get the following: Warning: mysqli_connect(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: YES) in C:\xampp\htdocs\tutorialspoint\mysqli_connect.php on line 12 Could not connect to the database. As far as installing MySQL, I've just installed XAMPP on Windows 7 Professional. I thought XAMPP already has MySQL. Or have I misunderstood something? Edited April 12, 2018 by hfcnew Link to comment Share on other sites More sharing options...
Larry Posted April 14, 2018 Share Posted April 14, 2018 Yes, XAMMP includes MySQL. From the FAQ, it looks like XAMPP does not set a root user password: https://www.apachefriends.org/faq_windows.html You may or may not want to do that. But then you'll need to create a MySQL user with the username "username" and a password of "password" (or a different user and then use those appropriate values later). Link to comment Share on other sites More sharing options...
Recommended Posts