WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: natehawkes (---.dsl.in-addr.zen.co.uk)
Date: April 22, 2013 03:07PM

I am creating a content management system using PHP and MySQL and testing it on my local WAMPServer installation. I recently added a password to MySQL in order to test a separate PHP application, but removed it once I could not properly test the application on my local server. All of my other application installations are working perfectly. I am now being told by my custom application that:

"mysql_query(): Access denied for user ''@'localhost' (using password: NO) in C:\wamp\www\myapp\index.php on line 3"

When I am using any browser except Internet Explorer, I am still given access to the server and all of my applications work fine. I am still being given the error, but it is dismissed when it redirects to a login page and then does not appear when I am logged in. Only in IE am I constantly reminded and have to manually change to the login page before I am allowed to log in, then have to manually change to the main page before my credentials are recorded as accepted in the PHP $_SESSION. Put simply, what could the issue be, if the application works in every browser but IE? The issue should not exist, since PHP is server based, not browser based. Any redirect is performed via a META redirect, not a PHP 301/302, and my cache has been cleared for any and all browsers.

Any feedback and assistance would be greatly appreciated.

Nathan

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: RiggsFolly (---.as13285.net)
Date: April 22, 2013 05:09PM

Just a couple of points:

You dont put a password on MySQL, you put a password on MySQL user(s).

You wrote this
"mysql_query(): Access denied for user ''@'localhost' (using password: NO) in C:\wamp\www\myapp\index.php on line 3"

Was it a typo or are you actually trying to access the database with '' as the userid i.e. no entry in the userid fields of the mysql_connect??

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: natehawkes (---.dsl.in-addr.zen.co.uk)
Date: April 22, 2013 05:22PM

1) I apologise, the password was assigned to the 'root' user (the only user I have). It has now returned to 'root' with no password (default settings).

2) That has been copied directly from the page. From what I can see, I am using the 'root' user with no password. How it is asking for no user with no password is beyond me.

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: RiggsFolly (---.as13285.net)
Date: April 22, 2013 06:23PM

Post the statemant as it is coded just dso we can check

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: natehawkes (---.dsl.in-addr.zen.co.uk)
Date: April 22, 2013 06:38PM

Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in C:\wamp\www\myapp\index.php on line 3
Call Stack
# Time Memory Function Location
1 0.0231 148696 {main}( ) ..\index.php:0
2 0.0545 153024 mysql_query ( ) ..\index.php:3

I hope that this is easy to decipher, I copied the entire table for you.

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: RiggsFolly (---.as13285.net)
Date: April 22, 2013 09:03PM

Sorry I meant the php code

mysql_connect( ......)

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: natehawkes (---.demon.co.uk)
Date: April 23, 2013 02:46PM

No worries, it's:

$mysql_server="localhost";
$mysql_username="root";
$mysql_password="";

mysql_connect($mysql_server,$mysql_username,$mysql_password) or die("MySQL Error: ".mysql_error());
mysql_select_db("myapp"winking smiley or die("MySQL Error: ".mysql_error());


It even does the same when I use mysql_connect('localhost','root','') instead of my variables.

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: RiggsFolly (---.as13285.net)
Date: April 23, 2013 11:27PM

Ok just to prove if I am on the right course here can you do this please.


wampmanager -> MySQL -> MySQL Console

This will launch a command window and automatically connect to MySQL and then wait for you to enter your root password.

So it you just hit 'Enter' if the root user has in fact got no password it will logon and give you the mysql prompt like this
mysql>

Just keyin 'quit' to exit the window/


If the window instantly closes then you have entered the wrong password, in other words 'root' does still have a password.

If that happens try the whole process again and this time enter the password you set for 'root' and thought you had removed!

What happens now

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: natehawkes (---.demon.co.uk)
Date: April 24, 2013 11:37AM

WITH NO PASSWORD

Enter password:

(Press enter)

Welcome to the MySQL monitor. Commands end with ; or \g.

etc. etc. etc.

mysql>

(type Quit)

bye

WITH PASSWORD

Enter password:

(type password)

ERROR

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: RiggsFolly (---.as13285.net)
Date: April 24, 2013 01:22PM

Ok last try before I go for the TeamViewer option:

There are actually what appears to be 3 'root' users with a default out of the box install of wamp.

root@localhost
root@127.0.0.1
root@::1

These indicate that you can login with the root password from 3 different ip address's.

When you add a password to the root user do you add it ( the same one ) to all 3 or just one of these?

They are all basically the same place but are actually different and depend upon setup and which IP Address range the browser uses ( arbitrary decision in some cases ).

If you change the root@localhost password but the browser uses the IPV6 ::1 address and you have not setup your hosts file so it knows that ::1 is also called localhost this could explain your problem.


So basically add the same password OR remove the password from all 3 and see what happens.

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: natehawkes (---.demon.co.uk)
Date: April 24, 2013 01:50PM

I plead ignorance on this front, I would have thought it would be to all accounts. From what you have told me, it may only be localhost, since I connect to the database via localhost. However, I do use subdomains in WAMPServer, which all point to 127.0.0.1. How do I check if the password is applied to 127.0.01? Just to be sure.

Again, I plead ignorance.

Options: ReplyQuote
Re: WAMPServer / MySQL telling me I have a password set when I do not.
Posted by: RiggsFolly (---.as13285.net)
Date: April 24, 2013 03:47PM

Just make sure you set the same password on all 3 occurances or root, or clear all 3 !!

Options: ReplyQuote


Sorry, only registered users may post in this forum.