#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    15
    $db = mysql_connect("localhost","username","password");

    How would I rewrite this connect statement if I were trying to connect to the database from a different host?

    Meaning, the current db is on www.webpage.com , the above connect statement would be placed on www.adifferentwebpage.com. Seems like this would be a simple task, but I can't find anything in my documentation.

    TIA,
    Mike
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    15
    $db = mysql_connect('www.otherserver.com','username,'password');

    Make sure that you set the permissions IN Mysql
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    15
    Maybe that is the problem. I tried the proper syntax you listed, and the page timed out.

    How do I configure MySQL to accept remote queries?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Seattle, WA,USA
    Posts
    84
    Rep Power
    15
    hmmm, i forget... I'll look it up for you.
  8. #5
  9. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    grant (ALL | specific permissions ) on *.* to username@% identified by 'password'

    *.* is in the format dbname.tablename. if you want to grant permission to all DBs/tables then leave it as *.*, if all tables of a specific Db then use dbname.*

    The % character is a wildcard for the remote client (where the user will be connecting from). If they'll be connecting from multiple locations leave it a % (this is not very secure, tho). Else supply the hostname (valid domain name or IP address).

Similar Threads

  1. free mysql host for 1 database for a forum
    By DaSimpsons2003 in forum Free Web Hosting
    Replies: 23
    Last Post: June 10th, 2004, 10:38 PM
  2. Accessing a Mysql Database on a different host.
    By tekgen in forum MySQL Help
    Replies: 2
    Last Post: February 1st, 2004, 07:54 PM
  3. 2-dimensial array / mysql_fetch_array database problem
    By paulx82 in forum PHP Development
    Replies: 3
    Last Post: December 27th, 2003, 02:52 AM
  4. creating database & tables using ASP
    By pdxlooie in forum ASP Programming
    Replies: 2
    Last Post: December 26th, 2003, 06:27 PM

IMN logo majestic logo threadwatch logo seochat tools logo