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

    Join Date
    Jun 2000
    Rep Power
    Hello again, I am having trouble connecting to a mySQL server that resides on another machine. Can someone provide me with some code that works for PHP 3/4 to connect to a server other than 'localhost'?

  2. #2
  3. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2000
    Enschede, The Netherlands
    Rep Power

    Instead of localhost, you can also type the ip or url of the remote server...
    At least, that works with me..

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>
    mysql_connect( www.myserver.com, user, passwd );
    mysql_select_db etc...

    The user(name) you use has to have access to the server from a not-localhost location. If the code above doesn't work, this could be the problem. If you have access to the remote server you can change the mysql settings... (read the mysql-manual on how to do this: something with access privileges or something I think)


Similar Threads

  1. Custom error message for MySQL connection
    By dbr1066 in forum PHP Development
    Replies: 6
    Last Post: February 12th, 2004, 11:25 AM
  2. Check MySQL Version thru PHP
    By wolftrap1 in forum PHP Development
    Replies: 2
    Last Post: February 11th, 2004, 08:51 PM
  3. Replies: 5
    Last Post: February 11th, 2004, 02:18 AM
  4. Replies: 0
    Last Post: February 10th, 2004, 11:44 PM
  5. Replies: 0
    Last Post: January 30th, 2004, 01:22 PM

IMN logo majestic logo threadwatch logo seochat tools logo