Jump to content

Connecting To Non Localhost?


Spunky
 Share

Recommended Posts

So, I have a website on a server but I am also trying to submit it to my school's server fir a website contest. I realized that to do that I could no longer connect to my database that I use on site with localhost so figured out how to do it by replacing localhost with website.com and it kinda worked cept I am getting access denied.

$db_link = @mysql_connect('wowtah.com', 'user_name', 'passowrd') or die(mysql_error());

The error I get on the site is:Access denied for user 'user_name'@'web.school.edu' (using password: YES)Im not sure why it is doing this, any help? I spose if I had to I could just have any links that go to the database page link to the ones up on my server instead and as long as I still have the pages uploaded to their server to see the code I used then I would still get full credit for it, but, this is a good learning experience so, I would like to figure this out. Thank you. :)

Link to comment
Share on other sites

By default, MySQL forbids remote access to any accounts, including the root one. You need to explicitly add the IP or domain the certain user can connect from. Not only that, but you also need to explicitly enable access to the databases and their privilages that this user can do from that host.You can do all of that with MySQL Administrator, while being on the MySQL server itself. Right click your username and select "Add host from which the user can connect". After entering the IP/domain of the remote host (I think in your case, "web.school.edu" should do it), go to "Schema Privilages", select the database you want to access, and click the ">>" button to enable complete access to it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...