MySQL Forums
Forum List  »  Install & Repo

Re: Error Connecting to DataBase!: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
Posted by: Peter Brawley
Date: October 07, 2017 09:46AM

First, establish that the Wamp web server is functional by typing ...

localhost

... into your web browser navigator control. You see the Wampserver home page?

Then do the same with the name of your machine. Same result?

Then try ...

localhost/index.php

Same result? If not, there's a wamp problem.

Next, prove you can connect via PHP to a local MySQL account. As root in the mysql client issue this ...

create user 'test'@'localhost' identified by 'some_password';
grant select on test.* to 'test'@'localhost';

Then create test.php in /wamp/www ...

<?php
$conn = mysqli_connect("localhost", "test", "some_password", "test" ) or exit( mysqli_connect_error() );

echo "Connected";
?>

... and browse localhost/test.php. If you see "Connected", PHP and MySQL are working together. If you see your DNS error, it may be a browser cache problem. In a cmd window issue ...

ipconfig /flushdns

... then try again.

Options: ReplyQuote


Subject
Written By
Posted
Re: Error Connecting to DataBase!: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
October 07, 2017 09:46AM


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.