MySQL Forums
Forum List  »  Newbie

Access denied to database - password NO
Posted by: john o'Rourke
Date: February 07, 2014 11:44PM

Hi,
I am working on a windows vista sp2 computer using iis. I have php and mysql. I am trying to connect to the sakila database. The mysql utility can talk to the database and the tables and records. The utility can actually generate code to talk to the database :
<?php
$host="localhost";
$port=3307;
$socket="";
$user="root";
$password="";
$dbname="sakila";

$con = new mysqli($host, $user, $password, $dbname, $port, $socket)
or die ('Could not connect to the database server' .
mysqli_connect_error());

//$con->close();
?>
I am using the chrome browser and when I put the command "localhost/dbconcomp.php" and press enter in the address bar, the following error is generated:

PHP Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in C:\inetpub\wwwroot\dbconcomp.php on line 9

Line 9 is the connection line. Apparently it doesn't like the "" password but what can I do about this as I do not have a password on this sample database?

Options: ReplyQuote


Subject
Written By
Posted
Access denied to database - password NO
February 07, 2014 11:44PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.