Connecting Tech Pros Worldwide Help | Site Map

mysql accessed remotely

Kenneth
Guest
 
Posts: n/a
#1: Jul 17 '05
I want to know how you can access a remote mySQL database from a php script.

Also how can I connect to a remote mysql database from mysql administrator?
Chris Hope
Guest
 
Posts: n/a
#2: Jul 17 '05

re: mysql accessed remotely


Kenneth wrote:
[color=blue]
> I want to know how you can access a remote mySQL database from a php
> script.[/color]

mysql_connect($ipaddress, $username, $password);

where $ipaddress is the IP address of the server you want to connect to.
Note that you may not be able to connect to a remote mysql database if
a) the firewall blocks the mysql port b) mysql is not configured to
listen to a port or c) your login doesn't have privileges to connect
remotely.
[color=blue]
> Also how can I connect to a remote mysql database from mysql
> administrator?[/color]

Find the configuration dialog and set the hostname to an IP address. See
above notes about why you still may not be able to connect.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Kenneth
Guest
 
Posts: n/a
#3: Jul 17 '05

re: mysql accessed remotely


Here is the message i get when i use

mysql_connect($ipaddress, $username, $password);


error:

Warning: mysql_connect(): Unknown MySQL Server Host 'db195.perfora.net'
(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
on line 9

Fatal error: Unknown MySQL Server Host 'db195.perfora.net' (1) in
/oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php on line 9






Chris Hope wrote:[color=blue]
> Kenneth wrote:
>
>[color=green]
>>I want to know how you can access a remote mySQL database from a php
>>script.[/color]
>
>
> mysql_connect($ipaddress, $username, $password);
>
> where $ipaddress is the IP address of the server you want to connect to.
> Note that you may not be able to connect to a remote mysql database if
> a) the firewall blocks the mysql port b) mysql is not configured to
> listen to a port or c) your login doesn't have privileges to connect
> remotely.
>
>[color=green]
>>Also how can I connect to a remote mysql database from mysql
>>administrator?[/color]
>
>
> Find the configuration dialog and set the hostname to an IP address. See
> above notes about why you still may not be able to connect.
>[/color]
Gordon Burditt
Guest
 
Posts: n/a
#4: Jul 17 '05

re: mysql accessed remotely


>mysql_connect($ipaddress, $username, $password);[color=blue]
>
>
>error:
>
>Warning: mysql_connect(): Unknown MySQL Server Host 'db195.perfora.net'
>(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
>on line 9
>
>Fatal error: Unknown MySQL Server Host 'db195.perfora.net' (1) in
>/oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php on line 9[/color]

db195.perfora.net is not a valid hostname. Fix your hostname
or fix your DNS.

Gordon L. Burditt
Kenneth
Guest
 
Posts: n/a
#5: Jul 17 '05

re: mysql accessed remotely


Gordon, why is not a valid hostname. and also how do i get the ip for
db195.perfora.net?


Gordon Burditt wrote:[color=blue][color=green]
>>mysql_connect($ipaddress, $username, $password);
>>
>>
>>error:
>>
>>Warning: mysql_connect(): Unknown MySQL Server Host 'db195.perfora.net'
>>(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
>>on line 9
>>
>>Fatal error: Unknown MySQL Server Host 'db195.perfora.net' (1) in
>>/oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php on line 9[/color]
>
>
> db195.perfora.net is not a valid hostname. Fix your hostname
> or fix your DNS.
>
> Gordon L. Burditt[/color]
Chris Hope
Guest
 
Posts: n/a
#6: Jul 17 '05

re: mysql accessed remotely


Kenneth wrote:
[color=blue]
> Gordon, why is not a valid hostname. and also how do i get the ip
> for db195.perfora.net?[/color]

You run "nslookup db195.perfora.net" to get the IP address. This tells
you that there is no such hostname which is why Gordon would have said
it's not valid.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Kenneth
Guest
 
Posts: n/a
#7: Jul 17 '05

re: mysql accessed remotely


So what is the next step?


Chris Hope wrote:[color=blue]
> Kenneth wrote:
>
>[color=green]
>>Gordon, why is not a valid hostname. and also how do i get the ip
>>for db195.perfora.net?[/color]
>
>
> You run "nslookup db195.perfora.net" to get the IP address. This tells
> you that there is no such hostname which is why Gordon would have said
> it's not valid.
>[/color]
Chris Hope
Guest
 
Posts: n/a
#8: Jul 17 '05

re: mysql accessed remotely


Kenneth wrote:
[color=blue][color=green][color=darkred]
>>>Gordon, why is not a valid hostname. and also how do i get the ip
>>>for db195.perfora.net?[/color]
>>
>> You run "nslookup db195.perfora.net" to get the IP address. This
>> tells you that there is no such hostname which is why Gordon would
>> have said it's not valid.[/color]
>
> So what is the next step?[/color]

Use a valid hostname. Or find out the actual IP address of the server
you are trying to connect to. It's better to use the IP address anyway
to prevent any extra latency required in looking it up each time your
script wants to connect to the server.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Kenneth
Guest
 
Posts: n/a
#9: Jul 17 '05

re: mysql accessed remotely


Chris you were right it was behind a firewall. So now I am running
script inside the server.

Thanks.


Chris Hope wrote:[color=blue]
> Kenneth wrote:
>
>[color=green][color=darkred]
>>>>Gordon, why is not a valid hostname. and also how do i get the ip
>>>>for db195.perfora.net?
>>>
>>>You run "nslookup db195.perfora.net" to get the IP address. This
>>>tells you that there is no such hostname which is why Gordon would
>>>have said it's not valid.[/color]
>>
>>So what is the next step?[/color]
>
>
> Use a valid hostname. Or find out the actual IP address of the server
> you are trying to connect to. It's better to use the IP address anyway
> to prevent any extra latency required in looking it up each time your
> script wants to connect to the server.
>[/color]
Closed Thread