Re: mySQL accessed remotely
- From: Chris Hope <blackhole@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 22:41:52 +1200
coolsti wrote:
> On Wed, 27 Apr 2005 18:32:12 -0700, Kenneth wrote:
>
>> 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?
>
> don't know if you found the proper answer from the other posters, who
> seemed to just send you links.
>
> All you need to do to access remotely, assuming you have the
> permission to do so and assuming you can indeed make a connection to
> the remote server, is to specify the correct host variable.
>
> If you are trying to connect to mysql as user "dbuser" using a
> password on your local computer (from a terminal window), you of
> course can use
>
>> mysql -u dbuser -p
>
> but if the database is located on a remote server, say at
> www.website.com, then the command becomes
>
>> mysql -h www.website.com -u dbuser -p
>
> This is the same set of arguments you use for any mysql administrative
> program called from the command line, for example mysql dump:
>
>> mysqldump -h www.website.com -u dbuser -p --all-databases > dump.sql
>
> And similarly, if you are going to connect from a php script, you
> basically do the same trick: you specify the HOST in the php function
> call:
>
>> $mysql = mysql_connect($host,$user,$password);
>
> with $host set in this case to 'www.website.com'
>
> Hope that helps.
I actually provided an answer about how to do it, to the same post which
was posted separately to comp.lang.php - this is why people should
crosspost and not multipost. If he'd crossposted then my answer would
have appeared in this group as well.
--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
.
- References:
- mySQL accessed remotely
- From: Kenneth
- Re: mySQL accessed remotely
- From: coolsti
- mySQL accessed remotely
- Prev by Date: Re: mySQL accessed remotely
- Next by Date: Re: genius connect
- Previous by thread: Re: mySQL accessed remotely
- Next by thread: classes confusion
- Index(es):
Relevant Pages
|