SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member veeracs's Avatar
    Join Date
    Oct 2003
    Location
    Missouri
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    connect to remote mysql server using a Php script

    My Php script runs on my university campus server.
    And I have installed mysql on my local machine.

    The following statement doesn't establish a connection

    $dbcnx = @mysql_connect("ipaddress", "root", "mypassword");

    ipaddress is the address of the machine which has mysql installed.

    Do I need to have additional permissions for accessing the mysql database on my machine from the php script.

    The book Datasbase Driven Website using Php and MySql ran me smooth until here.

    I appreciate any help.

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.mysql.com/doc/en/Connection_access.html

    And I guess you have to configure your firewall to allow connections to mysql too (port 3306?)

  3. #3
    SitePoint Enthusiast Deo's Avatar
    Join Date
    Oct 2003
    Location
    Washington, USA
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by veeracs
    Do I need to have additional permissions for accessing the mysql database on my machine from the php script.
    Just make sure that MySQL server is setup to allow connections from the accessing computer for the username you are attempting to connect with.

    If you are trying to connect from a dynamic ip address, you can set it up to allow connections from xxx.xxx.xxx.% if your server supports it.

    The book is right...just left room for you to learn a little on your own.

    ~Deo

  4. #4
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the other way around is more common; testing php scripts locally, but using a remote mysql server

    Just wondering: impossible to (get permission to) create a mysql db at the university?

  5. #5
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Deo
    If you are trying to connect from a dynamic ip address...
    Isn't the problem; veeracs is trying to connect to a dynamic ip?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •