Skip navigation links

MySQL Forums :: PHP :: Access denied for user 'user'@'localhost' (using password: YES)


Advanced Search

Access denied for user 'user'@'localhost' (using password: YES)
Posted by: James Gartlan ()
Date: July 28, 2013 10:52AM

Hi there – I am having trouble connecting to mysql database. Because I am not finding the issue easily, here is the basics of my scenario. I’m hoping I can get some quick help here.

I have installed PHP 5.3.27 non thread safe version in directory C:\Program Files (x86)\PHP. Whilst installing I didn’t set up a web server and installed the default items.

Using command prompt I have been able to run php commands. The php folder was automatically added to my environment variables path (and I also added the specific executable C:\Program Files (x86)\PHP\php.exe).

I have installed MySQL Sever 5.6 standard configuration. The MySQL folder was not however automatically added to my environment variables path even though I did ask it to upon setup (I have added the folder now C:\Program Files\MySQL\MySQL Server 5.6\bin).

Using MySQL command prompt I can login and create, delete tables etc. no problem. I’ve been using the MySQL workbench to do databse work.
I put together a simple php script to test the mysql connection:

<?php
mysql_connect("localhost", "user", "password")
or die ("<p>Error connecting to database: ". mysql_error() . "</p>");
echo "<p>Connected to MySQL!</p>";
?>

When I run this in my browser I get the following:
Error connecting to database: Access denied for user 'user'@'localhost' (using password: YES)

I have enabled full privileges for users. The username and password I am trying are the same ones I used when installing MySQL and to use MySQL workbench. Not sure what other user and password details there could be.

I’ve checked the MySQL Server to ensure it is running. When I check the user details in MySQL Workbench, the encrypted passwords appear to be much longer than the passwords I set (ssh passwords are they?) – and when I try to reset these to the passwords I use, they still show as longer. Thought I’d mention this, even if it is not an issue.

Any idea why I am still unable to make a MySQL connection through the php script? Am I missing something fundamental – do I need download some additional tool(s) To allow MySQL and php to work together?

Cheers – much appreciated.

Options: ReplyQuote


Subject Written By Posted
Access denied for user 'user'@'localhost' (using password: YES) James Gartlan 07/28/2013 10:52AM
Re: Access denied for user 'user'@'localhost' (using password: YES) Peter Brawley 07/28/2013 02:06PM
Re: Access denied for user 'user'@'localhost' (using password: YES) Jim Gartlan 07/29/2013 11:16PM
Re: Access denied for user 'user'@'localhost' (using password: YES) Peter Brawley 07/30/2013 10:50AM
Re: Access denied for user 'user'@'localhost' (using password: YES) Jim Gartlan 08/17/2013 07:48AM
Re: Access denied for user 'user'@'localhost' (using password: YES) Peter Brawley 08/17/2013 09:48AM
Re: Access denied for user 'user'@'localhost' (using password: YES) Jim Gartlan 08/17/2013 12:08PM
Re: Access denied for user 'user'@'localhost' (using password: YES) Peter Brawley 08/17/2013 02:25PM
Re: Access denied for user 'user'@'localhost' (using password: YES) Jim Gartlan 08/18/2013 12:33PM
Re: Access denied for user 'user'@'localhost' (using password: YES) Peter Brawley 08/19/2013 01:11PM
Re: Access denied for user 'user'@'localhost' (using password: YES) Sonal Sinha 08/20/2013 12:33AM


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.