Query on MSQL

Query on MSQL

am 16.05.2006 21:27:48 von refugeedeveloper

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.

Re: Query on MSQL

am 16.05.2006 22:06:56 von Aggro

refugeedeveloper@yahoo.co.in wrote:
> 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?

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.

Re: Query on MSQL

am 16.05.2006 22:08:35 von Aggro

refugeedeveloper@yahoo.co.in wrote:
> 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?

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).

Re: Query on MSQL

am 16.05.2006 22:15:04 von Bill Karwin

refugeedeveloper@yahoo.co.in wrote:
> 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.

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.

Re: Query on MSQL

am 16.05.2006 22:58:46 von refugeedeveloper

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.

Re: Query on MSQL

am 16.05.2006 23:22:33 von Aggro

refugeedeveloper@yahoo.co.in wrote:
> Im trying to use the mysql_connect command to connect to the mysql
> server from a php file.

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.

Re: Query on MSQL

am 16.05.2006 23:37:58 von Bill Karwin

refugeedeveloper@yahoo.co.in wrote:
> Ive tried 'localhost' and the address of the web site. The php program
> still comes up with message "cant connect to server"

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.

Re: Query on MSQL

am 16.05.2006 23:42:01 von refugeedeveloper

:-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.

Re: Query on MSQL

am 17.05.2006 16:58:49 von Aggro

refugeedeveloper@yahoo.co.in wrote:

> well I setup the database myself -- thats kind of how I know the
> username password.
>
> Not sure what variable to put for parameter "host".

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

Re: Query on MSQL

am 18.05.2006 23:53:41 von refugeedeveloper

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==)

Re: Query on MSQL

am 19.05.2006 00:32:15 von Aggro

refugeedeveloper@yahoo.co.in wrote:
> 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==)

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

Re: Query on MSQL

am 19.05.2006 10:31:23 von refugeedeveloper

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.