Connecting Tech Pros Worldwide Help | Site Map

mysql accessed remotely

  #1  
Old July 17th, 2005, 01:52 PM
Kenneth
Guest
 
Posts: n/a
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?
  #2  
Old July 17th, 2005, 01:52 PM
Chris Hope
Guest
 
Posts: n/a

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
  #3  
Old July 17th, 2005, 01:58 PM
Kenneth
Guest
 
Posts: n/a

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]
  #4  
Old July 17th, 2005, 01:58 PM
Gordon Burditt
Guest
 
Posts: n/a

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
  #5  
Old July 17th, 2005, 01:59 PM
Kenneth
Guest
 
Posts: n/a

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]
  #6  
Old July 17th, 2005, 01:59 PM
Chris Hope
Guest
 
Posts: n/a

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
  #7  
Old July 17th, 2005, 01:59 PM
Kenneth
Guest
 
Posts: n/a

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]
  #8  
Old July 17th, 2005, 01:59 PM
Chris Hope
Guest
 
Posts: n/a

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
  #9  
Old July 17th, 2005, 02:00 PM
Kenneth
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP, MySQL & FC6 martinf answers 4 April 18th, 2007 11:25 AM
Tool to export MS Access forms, queries, tables, and (eventually) code dtecmeister@gmail.com answers 7 July 4th, 2006 08:45 AM
Select/Update/Delete by Primary key failing with InnoDB skidvd answers 2 July 20th, 2005 01:02 AM
mysqld got signal 11; Stephane Raimbault answers 0 July 19th, 2005 11:51 PM