Connecting Tech Pros Worldwide Help | Site Map

mysql accessed remotely

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 12:52 PM
Kenneth
Guest
 
Posts: n/a
Default mysql accessed remotely

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, 12:52 PM
Chris Hope
Guest
 
Posts: n/a
Default 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, 12:58 PM
Kenneth
Guest
 
Posts: n/a
Default 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, 12:58 PM
Gordon Burditt
Guest
 
Posts: n/a
Default 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, 12:59 PM
Kenneth
Guest
 
Posts: n/a
Default 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, 12:59 PM
Chris Hope
Guest
 
Posts: n/a
Default 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, 12:59 PM
Kenneth
Guest
 
Posts: n/a
Default 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, 12:59 PM
Chris Hope
Guest
 
Posts: n/a
Default 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, 01:00 PM
Kenneth
Guest
 
Posts: n/a
Default 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]
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.