Jump to content

Unable to connect to MySQL


Fmdpa

Recommended Posts

I’m having such a hard time getting MySQL to work. I decided installed WAMP today because I thought it would be easier to work with the preconfigured installation. It is much easier than manually installing the components, BTW. Even though I figured out how to add/change a password (phpMyAdmin), I can’t connect to MySQL. My username is “root” and the password is “admin”. Here’s what I used to attempt a connection to MySQL.

<?php$con = mysql_connect("localhost","root","admin");if (!$con) {	die('Couldn\'t connect:' . mysql_error());	}?>

The error was this: “ Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\newdb.php on line 3Couldn't connect:Access denied for user 'root'@'localhost' (using password: YES) ”I tried using the same code above, except changing “mysql” to “mysqli”.

<?php$con = mysqli_connect("localhost","root","admin");if (!$con) {	die('Couldn\'t connect:' . mysqli_error());	}	?>

This is the error I got:“ Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\newdb.php on line 3Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in C:\wamp\www\newdb.php on line 6Couldn't connect: ”I’m reading about MySQL right now, and it sounds simple and so useful. But this is what’s holding me back. Do you have any suggestions?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...