Jump to content

Access denied for user 'WebUser' - Not a newbie question


Recommended Posts

Hello,

When trying to use mysql_connect to a database that is on a different server than the web server, I get the following error:

"Access denied for user 'WebUser'@'mydomain.com' (using password: YES)"

 

Here is my code, it's pretty simple and very vanilla:

mysql_connect ("myhost.com","WebUser","password") or die ("Couldn't connect with database!");

 

I'm not a newbie, and so yes, my username and password are correct. The permissions on the host are currently set to '%', so any IP address should be able to connect. I have tried explicity stating port 3306, and I can assume it is open because otherwise I would receive a timeout message. I can log into the database using the mysql client.

 

Does anyone have any idea? All I can find on the net are posts from people who have never used a computer before. Even if you don't know, do you know any way that I can get PHP to return an error that is a little more specific???

If that's the error you're getting, then that script isn't the one trying to connect. If it was, the only error you should get is "Couldn't connect with database!". There has to be another call to mysql_connect() somewhere that's producing the error.

Sorry, I may have edited what I said a bit to make it more clear. The EXACT output from my web server is:

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'WebUser'@'mydomain.com' (using password: YES) in /home/public_html/test2.php on line 2

Couldn't connect with database!

 

The entire code in the file is:

<?php
mysql_connect ("mydomain.com","WebUser","password") or die ("Couldn't connect with database!");
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.