BigBill Posted October 22, 2010 Share Posted October 22, 2010 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??? Quote Link to comment https://forums.phpfreaks.com/topic/216544-access-denied-for-user-webuser-not-a-newbie-question/ Share on other sites More sharing options...
Hybride Posted October 22, 2010 Share Posted October 22, 2010 PHP: mysql_connect. Quote Link to comment https://forums.phpfreaks.com/topic/216544-access-denied-for-user-webuser-not-a-newbie-question/#findComment-1125393 Share on other sites More sharing options...
Pikachu2000 Posted October 22, 2010 Share Posted October 22, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/216544-access-denied-for-user-webuser-not-a-newbie-question/#findComment-1125394 Share on other sites More sharing options...
BigBill Posted October 22, 2010 Author Share Posted October 22, 2010 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!"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/216544-access-denied-for-user-webuser-not-a-newbie-question/#findComment-1125417 Share on other sites More sharing options...
trq Posted October 23, 2010 Share Posted October 23, 2010 What GRANT OPTIONS did you give this user? Quote Link to comment https://forums.phpfreaks.com/topic/216544-access-denied-for-user-webuser-not-a-newbie-question/#findComment-1125429 Share on other sites More sharing options...
BigBill Posted October 24, 2010 Author Share Posted October 24, 2010 Read only on the entire table. A reporting application also connects to this server with this user name and has no problems. Quote Link to comment https://forums.phpfreaks.com/topic/216544-access-denied-for-user-webuser-not-a-newbie-question/#findComment-1125802 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.