Query on MSQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • refugeedeveloper@yahoo.co.in

    Query on MSQL

    Im trying to use the mysql_connect command to connect to the mysql
    server from a php file.

    What is the HOST name I should use?

    The tutorial book I have uses "localhost" but Im installing the file
    live on the internet, not on a local host machine on pc.

    (There are 3 parameters given --- hostname, username, userpassword.).



    thank you for any help.

  • Aggro

    #2
    Re: Query on MSQL

    refugeedevelope r@yahoo.co.in wrote:[color=blue]
    > Im trying to use the mysql_connect command to connect to the mysql
    > server from a php file.
    >
    > What is the HOST name I should use?[/color]

    Usually it is localhost. If it is something else, it is something like
    server.address. com or 192.168.0.1. But if your service provider didn't
    provide you any host address, then it is most likely localhost. If it
    isn't, then we have no way knowing what it is and you need to ask that
    from your service provider.

    Comment

    • Aggro

      #3
      Re: Query on MSQL

      refugeedevelope r@yahoo.co.in wrote:[color=blue]
      > Im trying to use the mysql_connect command to connect to the mysql
      > server from a php file.
      >
      > What is the HOST name I should use?[/color]

      Oh, and in case that wasn't obvious to you, the host name is the address
      of the machine where MySQL server is running (as you might know you can
      contact to server that is located on another computer than where your
      php script is running).

      Comment

      • Bill Karwin

        #4
        Re: Query on MSQL

        refugeedevelope r@yahoo.co.in wrote:[color=blue]
        > Im trying to use the mysql_connect command to connect to the mysql
        > server from a php file.
        >
        > What is the HOST name I should use?
        >
        > The tutorial book I have uses "localhost" but Im installing the file
        > live on the internet, not on a local host machine on pc.[/color]

        Use the hostname (or IP address) of the host running MySQL.

        If MySQL and your PHP scripts run on the same host, you can use the
        conventional alias "localhost" .

        The alias "localhost" means the same host which is initiating the
        connection. Not necessarily the host that is local to _you_.

        Regards,
        Bill K.

        Comment

        • refugeedeveloper@yahoo.co.in

          #5
          Re: Query on MSQL

          Thank you.

          Ive tried 'localhost' and the address of the web site. The php program
          still comes up with message "cant connect to server"

          you cant write a meaningfull php program wo access to mysql.

          Comment

          • Aggro

            #6
            Re: Query on MSQL

            refugeedevelope r@yahoo.co.in wrote:[color=blue]
            > Im trying to use the mysql_connect command to connect to the mysql
            > server from a php file.[/color]

            Are you sure that there even is a mysql server? Where did you find out
            that there is one and what the username and password and database name
            are for it? The page/mail that claims there is one, should have more
            info about what parameters to use to connect it.

            Comment

            • refugeedeveloper@yahoo.co.in

              #7
              Re: Query on MSQL

              :-0)

              well I setup the database myself -- thats kind of how I know the
              username password.

              Not sure what variable to put for parameter "host".

              Much more difficult to work in isolation than as a member of a team.

              Comment

              • Bill Karwin

                #8
                Re: Query on MSQL

                refugeedevelope r@yahoo.co.in wrote:[color=blue]
                > Ive tried 'localhost' and the address of the web site. The php program
                > still comes up with message "cant connect to server"[/color]

                I agree with Aggro -- find out from whomever manages the server host in
                question if MySQL is actually running. This is the first
                troubleshooting step.

                Regards,
                Bill K.

                Comment

                • Aggro

                  #9
                  Re: Query on MSQL

                  refugeedevelope r@yahoo.co.in wrote:
                  [color=blue]
                  > well I setup the database myself -- thats kind of how I know the
                  > username password.
                  >
                  > Not sure what variable to put for parameter "host".[/color]

                  In that case you should know the answer. Is the database server and php
                  files on the same computer or on two different computers?

                  Comment

                  • refugeedeveloper@yahoo.co.in

                    #10
                    Re: Query on MSQL

                    problem sorted. Problem with programming is usually the manual is
                    arcane, and you can go round and round for hours trying to sort a
                    simple problem -- easier to get help from your peers :0==)

                    Comment

                    • Aggro

                      #11
                      Re: Query on MSQL

                      refugeedevelope r@yahoo.co.in wrote:[color=blue]
                      > problem sorted. Problem with programming is usually the manual is
                      > arcane, and you can go round and round for hours trying to sort a
                      > simple problem -- easier to get help from your peers :0==)[/color]

                      I'm curious, what was wrong and what was the solution?

                      Comment

                      • refugeedeveloper@yahoo.co.in

                        #12
                        Re: Query on MSQL

                        I was using the username for the php server rather than the username
                        for the mysql server. You can spend hours and hours going round a
                        problem like this.

                        Comment

                        Working...