Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Location
    India
    Posts
    109

    Unanswered: Getting php to connect to database using 127.0.0.1

    Hi all,

    What does it take to get php to connect to local mysql/mssql server using 127.0.0.1? I am not able to use mysql_connect() or mssql_connect() using this ip.

    Can any one please point me to some links or help me in accomplishing the same? One point worth noting here is that, am able to use this local loop ip at workplace when am connected to the intranet.

    The moment I go out of the network, the mssql/mysql access is also denied for me. At home, I use an isp which overrides my local loop address. Only if I disconnect the internet connection, I am able to use "localhost". Even in this case, I am not able to use "127.0.0.1".

    Thanks in advance for your help.
    Celia

  2. #2
    Join Date
    Jan 2005
    Posts
    362

    Localhost

    First of all the [user you use]@localhost/127.0.0.1 has the permissions to "see" the mysql?
    If you are at a intranet, I think you have to put your ip adress for this network .
    At first if you use "localhost" you must not have problems, is not it?
    dimis
    Last edited by dimis2500; 12-22-05 at 08:38.

  3. #3
    Join Date
    Aug 2003
    Location
    India
    Posts
    109
    Yes. The user does have permissions. When am at work place, I use 127.0.0.1 to connect to mysql/mssql. But when am out of network am not able to use this ip. I would like to know how this is possible since its supposed to work either in/out of the network.

  4. #4
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    Are you trying to connect to the database on one machine from a different one?
    If this is the case, you must set up a user for the machine from which you are connecting. ie. if you're using your home computer then you must have a user 'username@homeipaddress' set up to use the mysql server. 127.0.0.1 is a loopback network connection. It is essentially the same as using localhost. Your machine's ip address is not 127.0.0.1, nobody's is.

    Is that what you were asking?

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    have a look at the grant syntax in the MySQL help file

    you can grant access based on an IP address (or partial IP Address), hostname etc..

    if you are running as a webserver then its the IP address of the server that needs to be added

Posting Permissions

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