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.
refugeedeveloper [ Di, 16 Mai 2006 21:27 ] [ ID #1316609 ]

Re: Query on MSQL

refugeedeveloper [at] 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.
Aggro [ Di, 16 Mai 2006 22:06 ] [ ID #1316610 ]

Re: Query on MSQL

refugeedeveloper [at] 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).
Aggro [ Di, 16 Mai 2006 22:08 ] [ ID #1316611 ]

Re: Query on MSQL

refugeedeveloper [at] 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.
Bill Karwin [ Di, 16 Mai 2006 22:15 ] [ ID #1316612 ]

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.
refugeedeveloper [ Di, 16 Mai 2006 22:58 ] [ ID #1316613 ]

Re: Query on MSQL

refugeedeveloper [at] 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.
Aggro [ Di, 16 Mai 2006 23:22 ] [ ID #1316614 ]

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.
refugeedeveloper [ Di, 16 Mai 2006 23:42 ] [ ID #1316615 ]

Re: Query on MSQL

refugeedeveloper [at] 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.
Bill Karwin [ Di, 16 Mai 2006 23:37 ] [ ID #1316616 ]

Re: Query on MSQL

refugeedeveloper [at] 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?
Aggro [ Mi, 17 Mai 2006 16:58 ] [ ID #1318167 ]

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==)
refugeedeveloper [ Do, 18 Mai 2006 23:53 ] [ ID #1319703 ]

Re: Query on MSQL

refugeedeveloper [at] 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?
Aggro [ Fr, 19 Mai 2006 00:32 ] [ ID #1319704 ]

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.
refugeedeveloper [ Fr, 19 Mai 2006 10:31 ] [ ID #1321258 ]
Datenbanken » mailing.database.mysql » Query on MSQL

Vorheriges Thema: Size of Text Field
Nächstes Thema: Database table row has all of its fields "shuffle" on it - ideas?