Allow friend to access MySQL db from my host

Allow friend to access MySQL db from my host

am 30.05.2006 22:23:18 von news

I have a few MySQL databases that came with my hosting package.
My friend has very simple webhosting and did not get any databases.
How do I allow him access to one of my databases? (I will create one for
his specific use).
Many times it asks for the direct path to the database but AFAIK this is
from my hosting. I guess I need to know how to point from his site to my
site with the database.

E.g. My site would have settings something like this:
My URL: www.mysite.com
Absolute path: "/home/mysite/public_html"
Database Name: mydbname
MySQL Hostname: localhost
MySQL Username: myusrname
Password: test

My friend's site would be:
www.myfriendssite.com
I realise that he can't use my absolute path in his php file settings.
Is it actually possible to have the database on my hosting space and
allow him to access it?
Thanks very much for any help.

Re: Allow friend to access MySQL db from my host

am 30.05.2006 22:35:24 von Rik

©® wrote:
> I have a few MySQL databases that came with my hosting package.
> My friend has very simple webhosting and did not get any databases.
> How do I allow him access to one of my databases? (I will create one
> for his specific use).
> Many times it asks for the direct path to the database but AFAIK this
> is from my hosting. I guess I need to know how to point from his site
> to my site with the database.

Normally, on shared hosting, the database isn't reachable from other
machines then the server itself. If you have total control over MySQL, you
could alter this, I doubt you have the rights ATM.

Probably the only way for him to use your database is to create dynamic
pages/files with output from the database, and possible input for the
database by forms. That would be:
a) A LOT of work.
b) A security disaster.

If your friend has the possibilies of actually using the data, he probably
has some server-side language like PHP (why else post in alt.php.sql?). In
that case he's better of using CSV's instead of a database.

In all propability, your friend also hasn't got any serverside language if
he hasn't got a database (in most hosting package these are combined), and
giving him access to that database isn't even usefull.

Grtz,
--
Rik Wasmus

Re: Allow friend to access MySQL db from my host

am 30.05.2006 22:35:24 von Rik

©® wrote:
> I have a few MySQL databases that came with my hosting package.
> My friend has very simple webhosting and did not get any databases.
> How do I allow him access to one of my databases? (I will create one
> for his specific use).
> Many times it asks for the direct path to the database but AFAIK this
> is from my hosting. I guess I need to know how to point from his site
> to my site with the database.

Normally, on shared hosting, the database isn't reachable from other
machines then the server itself. If you have total control over MySQL, you
could alter this, I doubt you have the rights ATM.

Probably the only way for him to use your database is to create dynamic
pages/files with output from the database, and possible input for the
database by forms. That would be:
a) A LOT of work.
b) A security disaster.

If your friend has the possibilies of actually using the data, he probably
has some server-side language like PHP (why else post in alt.php.sql?). In
that case he's better of using CSV's instead of a database.

In all propability, your friend also hasn't got any serverside language if
he hasn't got a database (in most hosting package these are combined), and
giving him access to that database isn't even usefull.

Grtz,
--
Rik Wasmus

Re: Allow friend to access MySQL db from my host

am 31.05.2006 01:12:50 von Martin Jay

In message , ©®
writes
>I have a few MySQL databases that came with my hosting package.
>My friend has very simple webhosting and did not get any databases.

[snip]

>I realise that he can't use my absolute path in his php file settings.
>Is it actually possible to have the database on my hosting space and
>allow him to access it?

Maybe not. For security reasons I think most hosts would disallow MySQL
access from outside their system.

As an alternative, would it be possible to give your friend his own FTP
account on host, so that he could upload his scripts to your hosting
package?

Or, perhaps he could get the scripts running locally and you could
upload them to your host when they're complete. This might become a
pain if the scripts change a lot. :)

There are some places offering free hosting with adverts. Perhaps use
one of those. With any luck the ads won't appear in PHP and Perl
scripts. :)
--
Martin Jay
Phone/SMS: +44 7740 191877
Fax: +44 870 915 2124

Re: Allow friend to access MySQL db from my host

am 31.05.2006 01:12:50 von Martin Jay

In message , ©®
writes
>I have a few MySQL databases that came with my hosting package.
>My friend has very simple webhosting and did not get any databases.

[snip]

>I realise that he can't use my absolute path in his php file settings.
>Is it actually possible to have the database on my hosting space and
>allow him to access it?

Maybe not. For security reasons I think most hosts would disallow MySQL
access from outside their system.

As an alternative, would it be possible to give your friend his own FTP
account on host, so that he could upload his scripts to your hosting
package?

Or, perhaps he could get the scripts running locally and you could
upload them to your host when they're complete. This might become a
pain if the scripts change a lot. :)

There are some places offering free hosting with adverts. Perhaps use
one of those. With any luck the ads won't appear in PHP and Perl
scripts. :)
--
Martin Jay
Phone/SMS: +44 7740 191877
Fax: +44 870 915 2124

Re: Allow friend to access MySQL db from my host

am 31.05.2006 05:52:11 von Shion

©® wrote:
> I have a few MySQL databases that came with my hosting package.
> My friend has very simple webhosting and did not get any databases.
> How do I allow him access to one of my databases? (I will create one for
> his specific use).
> Many times it asks for the direct path to the database but AFAIK this is
> from my hosting. I guess I need to know how to point from his site to my
> site with the database.

You need to have the right to use the GRANT sql-function in the database
http://dev.mysql.com/doc/refman/5.0/en/grant.html

But as everyone else already said, you won't.

You could make a "wrapper" php-script that your friend can call, which does
the sql queries for him on your database. But this will be a security problem
for you and will make your friends php-scripts a bit harder to write.



//Aho

Re: Allow friend to access MySQL db from my host

am 31.05.2006 05:52:11 von Shion

©® wrote:
> I have a few MySQL databases that came with my hosting package.
> My friend has very simple webhosting and did not get any databases.
> How do I allow him access to one of my databases? (I will create one for
> his specific use).
> Many times it asks for the direct path to the database but AFAIK this is
> from my hosting. I guess I need to know how to point from his site to my
> site with the database.

You need to have the right to use the GRANT sql-function in the database
http://dev.mysql.com/doc/refman/5.0/en/grant.html

But as everyone else already said, you won't.

You could make a "wrapper" php-script that your friend can call, which does
the sql queries for him on your database. But this will be a security problem
for you and will make your friends php-scripts a bit harder to write.



//Aho

Re: Allow friend to access MySQL db from my host

am 31.05.2006 16:14:39 von Frankly

dont mind me. I am a total newbie to this.
I thought sharing databases was a pretty easy thing to do.
I am surprised that you couldnt just create the database for him and let him
populate it.
I was thinking that my wife would be able to access the complete database
from her moble device.
then again being she doesnt have a moble device yet that would be a pretty
good trick.
--
Thank you
Frank
PHPmySQL1(remove)@yahoo.com

"©®" wrote in message
news:kqqdnT8Mc7wlNOHZnZ2dnUVZ8s-dnZ2d@pipex.net...
>I have a few MySQL databases that came with my hosting package.
> My friend has very simple webhosting and did not get any databases.
> How do I allow him access to one of my databases? (I will create one for
> his specific use).
> Many times it asks for the direct path to the database but AFAIK this is
> from my hosting. I guess I need to know how to point from his site to my
> site with the database.
>
> E.g. My site would have settings something like this:
> My URL: www.mysite.com
> Absolute path: "/home/mysite/public_html"
> Database Name: mydbname
> MySQL Hostname: localhost
> MySQL Username: myusrname
> Password: test
>
> My friend's site would be:
> www.myfriendssite.com
> I realise that he can't use my absolute path in his php file settings.
> Is it actually possible to have the database on my hosting space and allow
> him to access it?
> Thanks very much for any help.
>

Re: Allow friend to access MySQL db from my host

am 31.05.2006 16:14:39 von Frankly

dont mind me. I am a total newbie to this.
I thought sharing databases was a pretty easy thing to do.
I am surprised that you couldnt just create the database for him and let him
populate it.
I was thinking that my wife would be able to access the complete database
from her moble device.
then again being she doesnt have a moble device yet that would be a pretty
good trick.
--
Thank you
Frank
PHPmySQL1(remove)@yahoo.com

"©®" wrote in message
news:kqqdnT8Mc7wlNOHZnZ2dnUVZ8s-dnZ2d@pipex.net...
>I have a few MySQL databases that came with my hosting package.
> My friend has very simple webhosting and did not get any databases.
> How do I allow him access to one of my databases? (I will create one for
> his specific use).
> Many times it asks for the direct path to the database but AFAIK this is
> from my hosting. I guess I need to know how to point from his site to my
> site with the database.
>
> E.g. My site would have settings something like this:
> My URL: www.mysite.com
> Absolute path: "/home/mysite/public_html"
> Database Name: mydbname
> MySQL Hostname: localhost
> MySQL Username: myusrname
> Password: test
>
> My friend's site would be:
> www.myfriendssite.com
> I realise that he can't use my absolute path in his php file settings.
> Is it actually possible to have the database on my hosting space and allow
> him to access it?
> Thanks very much for any help.
>

Re: Allow friend to access MySQL db from my host

am 31.05.2006 17:53:59 von Shion

Frankly wrote:
> dont mind me. I am a total newbie to this.
> I thought sharing databases was a pretty easy thing to do.

It depends much on how you share it, say phpMySQLAdmin would allow people to
access ones database as long as they do have the login and password.

Direct access to a mysql server depends on how the grant command was used

GRANT ALL ON *.* TO 'evilbill'@'localhost' IDENTIFIED BY 'mypass';
This allows user evilbill to login with the password mypass as long as he does
this from the same computer as the database is running on.
This is how the grant is used on webhotels, to only allow access to the
database from the webserver.

GRANT ALL ON *.* TO 'evilbill'@'example.net' IDENTIFIED BY 'mypass';
This would allow user evilbill to login with the password mypass as long as he
does this from the computer with the ip-name example.net.

If you want to allow one user to access the database from two different
places, say from localhost and example.net, then you issue both the GRANT
statements.
GRANT ALL ON *.* TO 'evilbill'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL ON *.* TO 'evilbill'@'example.net' IDENTIFIED BY 'mypass';


> I am surprised that you couldnt just create the database for him and let him
> populate it.

The OP has a database on a webhotel, a webhotel allows only access from the
webserver to the sql-server, so they have issued

GRANT ALTER, CREATE, DELETE, DROP, INDEX, INSERT, SELECT, UPDATE ON
userdatabase.* TO 'evilbill'@'localhost' IDENTIFIED BY 'mypass';

this limits the things the user can do with the database, which would prevent
them from giving access for someone else from a remote location, which would
be needed for the OPs friend.


> I was thinking that my wife would be able to access the complete database
> from her moble device.

This will be possible, but I think she wants a frontend that is easy to use
for her (easier than phpMySQLAdmin) and as the frontend will be a number of
php pages, the webserver will access the page and you don't need to GRANT for
anyone remotely on your MySQL.



//Aho

Re: Allow friend to access MySQL db from my host

am 31.05.2006 17:53:59 von Shion

Frankly wrote:
> dont mind me. I am a total newbie to this.
> I thought sharing databases was a pretty easy thing to do.

It depends much on how you share it, say phpMySQLAdmin would allow people to
access ones database as long as they do have the login and password.

Direct access to a mysql server depends on how the grant command was used

GRANT ALL ON *.* TO 'evilbill'@'localhost' IDENTIFIED BY 'mypass';
This allows user evilbill to login with the password mypass as long as he does
this from the same computer as the database is running on.
This is how the grant is used on webhotels, to only allow access to the
database from the webserver.

GRANT ALL ON *.* TO 'evilbill'@'example.net' IDENTIFIED BY 'mypass';
This would allow user evilbill to login with the password mypass as long as he
does this from the computer with the ip-name example.net.

If you want to allow one user to access the database from two different
places, say from localhost and example.net, then you issue both the GRANT
statements.
GRANT ALL ON *.* TO 'evilbill'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL ON *.* TO 'evilbill'@'example.net' IDENTIFIED BY 'mypass';


> I am surprised that you couldnt just create the database for him and let him
> populate it.

The OP has a database on a webhotel, a webhotel allows only access from the
webserver to the sql-server, so they have issued

GRANT ALTER, CREATE, DELETE, DROP, INDEX, INSERT, SELECT, UPDATE ON
userdatabase.* TO 'evilbill'@'localhost' IDENTIFIED BY 'mypass';

this limits the things the user can do with the database, which would prevent
them from giving access for someone else from a remote location, which would
be needed for the OPs friend.


> I was thinking that my wife would be able to access the complete database
> from her moble device.

This will be possible, but I think she wants a frontend that is easy to use
for her (easier than phpMySQLAdmin) and as the frontend will be a number of
php pages, the webserver will access the page and you don't need to GRANT for
anyone remotely on your MySQL.



//Aho

Re: Allow friend to access MySQL db from my host

am 01.06.2006 18:36:39 von Frankly

"J.O. Aho" wrote in message
news:4e5sgoF1cjp9eU1@individual.net...
>
> This will be possible, but I think she wants a frontend that is easy to
> use for her (easier than phpMySQLAdmin) and as the frontend will be a
> number of php pages, the webserver will access the page and you don't need
> to GRANT for anyone remotely on your MySQL.
>
>
>
> //Aho

I have alot to learn. I think i burnt myself out a bit. I cant seem to get
myself to just finish up these damn tables. 1 thing that pisses me off
everytime is that damn disconnect after 1800 seconds and to be honest i
think it runs fast. if i get one phone call while I am in the middle of
something all work is lost.

Frank

Re: Allow friend to access MySQL db from my host

am 01.06.2006 18:36:39 von Frankly

"J.O. Aho" wrote in message
news:4e5sgoF1cjp9eU1@individual.net...
>
> This will be possible, but I think she wants a frontend that is easy to
> use for her (easier than phpMySQLAdmin) and as the frontend will be a
> number of php pages, the webserver will access the page and you don't need
> to GRANT for anyone remotely on your MySQL.
>
>
>
> //Aho

I have alot to learn. I think i burnt myself out a bit. I cant seem to get
myself to just finish up these damn tables. 1 thing that pisses me off
everytime is that damn disconnect after 1800 seconds and to be honest i
think it runs fast. if i get one phone call while I am in the middle of
something all work is lost.

Frank

Re: Allow friend to access MySQL db from my host

am 02.06.2006 01:06:03 von nc

©® wrote:
>
> I have a few MySQL databases that came with my hosting package.
> My friend has very simple webhosting and did not get any databases.

Then he probably doesn't have a MySQL client, either...

> How do I allow him access to one of my databases? (I will create one
> for his specific use).

Generally speaking, you should ask you hosting provider. It's entirely
possible that you cannot access your databases from anywhere other than
your hosting server. So you will not be able to let him use your
databases directly. This said, there are indirect ways (see below).

> E.g. My site would have settings something like this:
> My URL: www.mysite.com
> Absolute path: "/home/mysite/public_html"
> Database Name: mydbname
> MySQL Hostname: localhost
> MySQL Username: myusrname
> Password: test
>
> My friend's site would be:
> www.myfriendssite.com
>
> Is it actually possible to have the database on my hosting space
> and allow him to access it?

Yes, but you will have to write a middleware script, plus the
performance may be far from inspiring... Say, your friend wants to
retrieve some data, so he puts together a script like this:

$query =3D 'SELECT field1, field2 FROM the_table WHERE id=3D123';
$url =3D 'http://www.mysite.com/data.php?q=3D' . urlencode($query);
$data =3D file_get_contents($url);

Your data.php then could include this:

header('Content-Type: text/plain');
$query =3D $_GET['q'];
$result =3D mysql_query($query);
while ($record =3D mysql_fetch_row($result)) {
echo implode("\t", $record), "\r\n";
}

This will output the desired data in tab-delimited text format, which
your friend will then be able to use on his site. You could also
output CSV or XML if you want...

Note that the setup described above has no security features of any
kind. You will have to think of some...=20

Cheers,=20
NC

Re: Allow friend to access MySQL db from my host

am 02.06.2006 01:06:03 von nc

©® wrote:
>
> I have a few MySQL databases that came with my hosting package.
> My friend has very simple webhosting and did not get any databases.

Then he probably doesn't have a MySQL client, either...

> How do I allow him access to one of my databases? (I will create one
> for his specific use).

Generally speaking, you should ask you hosting provider. It's entirely
possible that you cannot access your databases from anywhere other than
your hosting server. So you will not be able to let him use your
databases directly. This said, there are indirect ways (see below).

> E.g. My site would have settings something like this:
> My URL: www.mysite.com
> Absolute path: "/home/mysite/public_html"
> Database Name: mydbname
> MySQL Hostname: localhost
> MySQL Username: myusrname
> Password: test
>
> My friend's site would be:
> www.myfriendssite.com
>
> Is it actually possible to have the database on my hosting space
> and allow him to access it?

Yes, but you will have to write a middleware script, plus the
performance may be far from inspiring... Say, your friend wants to
retrieve some data, so he puts together a script like this:

$query =3D 'SELECT field1, field2 FROM the_table WHERE id=3D123';
$url =3D 'http://www.mysite.com/data.php?q=3D' . urlencode($query);
$data =3D file_get_contents($url);

Your data.php then could include this:

header('Content-Type: text/plain');
$query =3D $_GET['q'];
$result =3D mysql_query($query);
while ($record =3D mysql_fetch_row($result)) {
echo implode("\t", $record), "\r\n";
}

This will output the desired data in tab-delimited text format, which
your friend will then be able to use on his site. You could also
output CSV or XML if you want...

Note that the setup described above has no security features of any
kind. You will have to think of some...=20

Cheers,=20
NC

Re: Allow friend to access MySQL db from my host

am 02.06.2006 20:15:36 von Frankly

trying not to smoke...... cant sit infront of computer too long.. gotta go.
just wanted to say hello. I am going nuts but this has to be done.
2 days :)

"teeth grinding - must run from computer"

"Frankly" wrote in message
news:rIEfg.273$Cw3.229@trndny01...
>
>
>
> "J.O. Aho" wrote in message
> news:4e5sgoF1cjp9eU1@individual.net...
> >
>> This will be possible, but I think she wants a frontend that is easy to
>> use for her (easier than phpMySQLAdmin) and as the frontend will be a
>> number of php pages, the webserver will access the page and you don't
>> need to GRANT for anyone remotely on your MySQL.
>>
>>
>>
>> //Aho
>
> I have alot to learn. I think i burnt myself out a bit. I cant seem to
> get myself to just finish up these damn tables. 1 thing that pisses me
> off everytime is that damn disconnect after 1800 seconds and to be honest
> i think it runs fast. if i get one phone call while I am in the middle of
> something all work is lost.
>
> Frank
>

Re: Allow friend to access MySQL db from my host

am 02.06.2006 20:15:36 von Frankly

trying not to smoke...... cant sit infront of computer too long.. gotta go.
just wanted to say hello. I am going nuts but this has to be done.
2 days :)

"teeth grinding - must run from computer"

"Frankly" wrote in message
news:rIEfg.273$Cw3.229@trndny01...
>
>
>
> "J.O. Aho" wrote in message
> news:4e5sgoF1cjp9eU1@individual.net...
> >
>> This will be possible, but I think she wants a frontend that is easy to
>> use for her (easier than phpMySQLAdmin) and as the frontend will be a
>> number of php pages, the webserver will access the page and you don't
>> need to GRANT for anyone remotely on your MySQL.
>>
>>
>>
>> //Aho
>
> I have alot to learn. I think i burnt myself out a bit. I cant seem to
> get myself to just finish up these damn tables. 1 thing that pisses me
> off everytime is that damn disconnect after 1800 seconds and to be honest
> i think it runs fast. if i get one phone call while I am in the middle of
> something all work is lost.
>
> Frank
>