PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Accessing a Database From A Different Website
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Accessing a Database From A Different Website

Réponse
 
LinkBack Outils de la discussion
Vieux 10/02/2008, 00h52   #1
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Accessing a Database From A Different Website

I've created a database on one of my Websites and I'm trying
to access it with a PHP script that runs on a different Web site and
hosting provider.

I used the Manage Remote MySQL Access and added both the
domain and www. plus the domain as domains authorized to access the
database.

I moved a script from the database domain to the other domain
I changed 'localhost' to the domain name of the database.

I keep getting an error when I run the script (that ran on the
database site). This is the error: Warning: mysql_connect()
[function.mysql-connect]: Access denied for user
'*************'@'*****.*************.com' (using password: YES) in
/home/******/public_html/********/index.php on line 8
Access denied for user **************'@'*******************.com'
(using password: YES).

This script worked fine when I used 'localhost' instead of the
domain name of the database.

Any ideas?

Regards,



Fred, WB4AEJ
  Réponse avec citation
Vieux 10/02/2008, 02h11   #2
Peter H. Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Sat, 09 Feb 2008 18:52:36 -0500, Fred Atkinson wrote:
> I've created a database on one of my Websites and I'm trying
> to access it with a PHP script that runs on a different Web site and
> hosting provider.
>
> I used the Manage Remote MySQL Access and added both the
> domain and www. plus the domain as domains authorized to access the
> database.
>
> I moved a script from the database domain to the other domain
> I changed 'localhost' to the domain name of the database.
>
> I keep getting an error when I run the script (that ran on the
> database site). This is the error: Warning: mysql_connect()
> [function.mysql-connect]: Access denied for user
> '*************'@'*****.*************.com' (using password: YES) in
> /home/******/public_html/********/index.php on line 8
> Access denied for user **************'@'*******************.com'
> (using password: YES).
>
> This script worked fine when I used 'localhost' instead of the
> domain name of the database.


Is this an *exactly* copy'n'paste of the error message (modulo
asterisks)? Because I'm seeing what look like random single-quotes
sprinkled in there like pepper on eggs...

--
41. Once my power is secure, I will destroy all those pesky time-travel
devices.
--Peter Anspach's list of things to do as an Evil Overlord
  Réponse avec citation
Vieux 10/02/2008, 02h30   #3
Gordon Burditt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

> I've created a database on one of my Websites and I'm trying
>to access it with a PHP script that runs on a different Web site and
>hosting provider.
>
> I used the Manage Remote MySQL Access and added both the


I don't know what that thingie is, but I presume it's some kind of
GUI administration tool, likely provided by your hosting provider.

>domain and www. plus the domain as domains authorized to access the
>database.


In the MySQL permissions system, you have to grant access to a specific
user for remote access from either specific sites or "any".

I suspect the GUI requires the same thing. Somehow.

It's also possible that your provider does not permit remote access at
all, but from the error message below, it seems you actually talked
to the MySQL server.

> I moved a script from the database domain to the other domain
>I changed 'localhost' to the domain name of the database.
>
> I keep getting an error when I run the script (that ran on the
>database site). This is the error: Warning: mysql_connect()
>[function.mysql-connect]: Access denied for user
>'*************'@'*****.*************.com' (using password: YES) in
>/home/******/public_html/********/index.php on line 8
>Access denied for user **************'@'*******************.com'
>(using password: YES).
>
> This script worked fine when I used 'localhost' instead of the
>domain name of the database.

  Réponse avec citation
Vieux 10/02/2008, 03h41   #4
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Sat, 9 Feb 2008 19:11:06 -0600, "Peter H. Coffin"
<hellsop@ninehells.com> wrote:

>Is this an *exactly* copy'n'paste of the error message (modulo
>asterisks)? Because I'm seeing what look like random single-quotes
>sprinkled in there like pepper on eggs...


I asterisked out the security information and yes the single
quotes were there before I asterisked them out.

Regards,



Fred
  Réponse avec citation
Vieux 10/02/2008, 04h05   #5
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Sun, 10 Feb 2008 01:30:27 -0000, gordonb.00fq1@burditt.org (Gordon
Burditt) wrote:

>> I used the Manage Remote MySQL Access and added both the

>
>I don't know what that thingie is, but I presume it's some kind of
>GUI administration tool, likely provided by your hosting provider.


It is.

>>domain and www. plus the domain as domains authorized to access the
>>database.

>
>In the MySQL permissions system, you have to grant access to a specific
>user for remote access from either specific sites or "any".


Hmmm. That may be my problem.

>I suspect the GUI requires the same thing. Somehow.


Possibly. I've got a support request in with my provider. But
I've no clue as to when they'll answer.

>It's also possible that your provider does not permit remote access at
>all, but from the error message below, it seems you actually talked
>to the MySQL server.


I thought that might be the case. But I spoke with their
phone support. The person I spoke to does not believe this to be the
case.

The script is working on the site when I use 'localhost'. So
I guess I just need to fix the remote access problem.

Regards,


Fred
  Réponse avec citation
Vieux 10/02/2008, 05h16   #6
Peter H. Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Sat, 09 Feb 2008 21:41:23 -0500, Fred Atkinson wrote:
> On Sat, 9 Feb 2008 19:11:06 -0600, "Peter H. Coffin"
><hellsop@ninehells.com> wrote:
>
>>Is this an *exactly* copy'n'paste of the error message (modulo
>>asterisks)? Because I'm seeing what look like random single-quotes
>>sprinkled in there like pepper on eggs...

>
> I asterisked out the security information and yes the single
> quotes were there before I asterisked them out.
>


Restoring stuff:

> I keep getting an error when I run the script (that ran on the
> database site). This is the error: Warning: mysql_connect()
> [function.mysql-connect]: Access denied for user
> '*************'@'*****.*************.com' (using password: YES) in

^-- dot
> /home/******/public_html/********/index.php on line 8
> Access denied for user **************'@'*******************.com'

no opening quote---^ no dot
> (using password: YES).


Now, are these copy/paste and obfuscation errors, or are IDs that
different? If they are transcription errors, then the only thing to
presume is that *somehow* the addition of the remote hostname users got
screwed up, and unfortunately, there's not much we can do to you
fix that without SEEING the security information.

--
Cunningham's Second Law:
It's always more complex than you expect, even when you take
Cunningham's Second Law into account.
  Réponse avec citation
Vieux 10/02/2008, 05h48   #7
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Sat, 9 Feb 2008 22:16:19 -0600, "Peter H. Coffin"
<hellsop@ninehells.com> wrote:

>Restoring stuff:
>
>> I keep getting an error when I run the script (that ran on the
>> database site). This is the error: Warning: mysql_connect()
>> [function.mysql-connect]: Access denied for user
>> '*************'@'*****.*************.com' (using password: YES) in

> ^-- dot
>> /home/******/public_html/********/index.php on line 8
>> Access denied for user **************'@'*******************.com'

> no opening quote---^ no dot
>> (using password: YES).

>
>Now, are these copy/paste and obfuscation errors, or are IDs that
>different? If they are transcription errors, then the only thing to
>presume is that *somehow* the addition of the remote hostname users got
>screwed up, and unfortunately, there's not much we can do to you
>fix that without SEEING the security information.


The id's were the same. Yes, the error message put the single
quotes in it. But I didn't put the single quotes in the code for the
username and password when I coded the script.

I'll create a 'read only' username and redo it. Then I can
post it. The one I used had no restrictions.

Regards,



Fred
  Réponse avec citation
Vieux 10/02/2008, 05h54   #8
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Sat, 9 Feb 2008 22:16:19 -0600, "Peter H. Coffin"
<hellsop@ninehells.com> wrote:

>Now, are these copy/paste and obfuscation errors, or are IDs that
>different? If they are transcription errors, then the only thing to
>presume is that *somehow* the addition of the remote hostname users got
>screwed up, and unfortunately, there's not much we can do to you
>fix that without SEEING the security information.


Warning: mysql_connect() [function.mysql-connect]: Access denied for
user 'wb4aej_wa4zzq'@'venus.myserverhosts.com' (using password: YES)
in /home/wb4aej/public_html/hdscript/index.php on line 8
Access denied for user 'wb4aej_wa4zzq'@'venus.myserverhosts.com'
(using password: YES)

Does this tell you anything?

Regards,



Fred
  Réponse avec citation
Vieux 10/02/2008, 15h10   #9
Terry Carmen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

Fred Atkinson wrote:
>
> I thought that might be the case. But I spoke with their
> phone support. The person I spoke to does not believe this to be the
> case.
>
> The script is working on the site when I use 'localhost'. So
> I guess I just need to fix the remote access problem.
>

In /etc/mysql/my.cnf

The line
bind-address = 127.0.0.1
needs to be commended out, or the server won't talk to outside clients.

You then need to restart MySQL.

Unfortunately, this means it will talk to any outside client, so make
sure you configure iptables or other firewall to reject any IPs you
don't want to connect with.

Terry




  Réponse avec citation
Vieux 10/02/2008, 15h21   #10
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

Peter H. Coffin wrote:
> On Sat, 09 Feb 2008 18:52:36 -0500, Fred Atkinson wrote:
>> I've created a database on one of my Websites and I'm trying
>> to access it with a PHP script that runs on a different Web site and
>> hosting provider.
>>
>> I used the Manage Remote MySQL Access and added both the
>> domain and www. plus the domain as domains authorized to access the
>> database.
>>
>> I moved a script from the database domain to the other domain
>> I changed 'localhost' to the domain name of the database.
>>
>> I keep getting an error when I run the script (that ran on the
>> database site). This is the error: Warning: mysql_connect()
>> [function.mysql-connect]: Access denied for user
>> '*************'@'*****.*************.com' (using password: YES) in
>> /home/******/public_html/********/index.php on line 8
>> Access denied for user **************'@'*******************.com'
>> (using password: YES).
>>
>> This script worked fine when I used 'localhost' instead of the
>> domain name of the database.

>
> Is this an *exactly* copy'n'paste of the error message (modulo
> asterisks)? Because I'm seeing what look like random single-quotes
> sprinkled in there like pepper on eggs...
>


Peter,

Yes, those asterisks would be correct in this message. They are not at
random places.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 10/02/2008, 15h34   #11
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

Fred Atkinson wrote:
> On Sat, 9 Feb 2008 22:16:19 -0600, "Peter H. Coffin"
> <hellsop@ninehells.com> wrote:
>
>> Now, are these copy/paste and obfuscation errors, or are IDs that
>> different? If they are transcription errors, then the only thing to
>> presume is that *somehow* the addition of the remote hostname users got
>> screwed up, and unfortunately, there's not much we can do to you
>> fix that without SEEING the security information.

>
> Warning: mysql_connect() [function.mysql-connect]: Access denied for
> user 'wb4aej_wa4zzq'@'venus.myserverhosts.com' (using password: YES)
> in /home/wb4aej/public_html/hdscript/index.php on line 8
> Access denied for user 'wb4aej_wa4zzq'@'venus.myserverhosts.com'
> (using password: YES)
>
> Does this tell you anything?
>
> Regards,
>
>
>
> Fred
>


Fred,

In MySQL, you can have a user who can access the data from the local
machine, a single remote host, or any remote hosts (and others). Each of
these is considered a different user.

You've got a user authorized for access from the local host. But this
does not give that user access from remote hosts. You also need to
create one with access from any host ('%' for the host) or a specific ip
address.

And getting back to your original problem, when you connect to the
database using 'localhost' or ip address '127.0.0.1', it is considered
to be local by MySQL and uses the userid for the local machine. But if
you use a domain name or other ip address, it is considered to be remote.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 10/02/2008, 18h33   #12
Peter H. Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Sun, 10 Feb 2008 09:10:19 -0500, Terry Carmen wrote:
> Fred Atkinson wrote:
>>
>> I thought that might be the case. But I spoke with their
>> phone support. The person I spoke to does not believe this to be the
>> case.
>>
>> The script is working on the site when I use 'localhost'. So
>> I guess I just need to fix the remote access problem.
>>

> In /etc/mysql/my.cnf
>
> The line
> bind-address = 127.0.0.1
> needs to be commended out, or the server won't talk to outside clients.
>
> You then need to restart MySQL.
>
> Unfortunately, this means it will talk to any outside client, so make
> sure you configure iptables or other firewall to reject any IPs you
> don't want to connect with.


That'd make the error

ERROR 2003 (HY000): Can't connect to MySQL server on
'othin.ninehells.com' (61)

It's FINDING a MySQL server, jut not authenticating.

The possible problems I can see are

1) The password isn't what Fred thinks it is, whether due to
misremembering or unclean pass-along from whatever this hosting config
tool is,

or,

2) The hostname of the client machine isn't what Fred thinks it is,
because the client has multiple IP addresses or the mysql server has a
different idea of what the DNS-lookup name is for that IP.


--
89. After I capture the hero's superweapon, I will not immediately disband my
legions and relax my guard because I believe whoever holds the weapon is
unstoppable. After all, the hero held the weapon and I took it from him.
--Peter Anspach's list of things to do as an Evil Overlord
  Réponse avec citation
Vieux 10/02/2008, 18h56   #13
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Sun, 10 Feb 2008 09:10:19 -0500, Terry Carmen
<terry@cnysupport.com> wrote:

>In /etc/mysql/my.cnf
>
>The line
>bind-address = 127.0.0.1
>needs to be commended out, or the server won't talk to outside clients.
>
>You then need to restart MySQL.
>
>Unfortunately, this means it will talk to any outside client, so make
>sure you configure iptables or other firewall to reject any IPs you
>don't want to connect with.
>
>Terry


Terry,

Since I am a Web hosting *reseller* (though most of the
hosting I do has been for free)), I don't have access to the /etc
directory.

However, it seems to be connecting to the database but the
username/password is being rejected.

Due to the nature of this database, there is no problem with
outsiders accessing it remotely. Everyone I give a password to will
only have the privileges of reading it, not writing to it.

There is a place in the GUI where I have to add domains that I
want to be able to access the database. So that is some additional
security.

I'm sure that no matter how secure I make it that someone will
try to hack in. That's the nature of the beast. And that's why I
will be keeping backups of the database.

Thanks for your feedback.

Regards,



Fred
  Réponse avec citation
Vieux 10/02/2008, 19h01   #14
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Sun, 10 Feb 2008 11:33:56 -0600, "Peter H. Coffin"
<hellsop@ninehells.com> wrote:

>That'd make the error
>
>ERROR 2003 (HY000): Can't connect to MySQL server on
>'othin.ninehells.com' (61)
>
>It's FINDING a MySQL server, jut not authenticating.
>
>The possible problems I can see are
>
>1) The password isn't what Fred thinks it is, whether due to
>misremembering or unclean pass-along from whatever this hosting config
>tool is,
>
>or,
>
>2) The hostname of the client machine isn't what Fred thinks it is,
>because the client has multiple IP addresses or the mysql server has a
>different idea of what the DNS-lookup name is for that IP.


Well,

My provide just gave me a B.S. reply telling me to contact him
if I had any more questions. I guess I'm going to have to call again
and demand to speak to that person.

Regards, and thanks,



Fred
  Réponse avec citation
Vieux 11/02/2008, 16h04   #15
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

Well,

There was an email in my box from my hosting provider telling
me how to fix it and it did. I was told to change the domain name to
the IP address.

Miraculously, it worked. But I tried that IP address thing
once before and it did not work until now.

I think my hosting provider found a problem that they
corrected and don't want to admit it.

So, I'm ready to move on with further development of the
script.

Regards,



Fred
  Réponse avec citation
Vieux 11/02/2008, 16h26   #16
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Mon, 11 Feb 2008 10:04:39 -0500, Fred Atkinson
<fatkinson@mishmash.com> wrote:

>Well,
>
> There was an email in my box from my hosting provider telling
>me how to fix it and it did. I was told to change the domain name to
>the IP address.
>
> Miraculously, it worked. But I tried that IP address thing
>once before and it did not work until now.
>
> I think my hosting provider found a problem that they
>corrected and don't want to admit it.
>
> So, I'm ready to move on with further development of the
>script.
>
> Regards,
>
>
>
> Fred


Guess what else? I change the IP address back to the domain
name and it *still* works. It didn't before.

I am now convinced that there was a problem on my hosting
provider's end.

Regards,



Fred
  Réponse avec citation
Vieux 11/02/2008, 17h22   #17
Peter H. Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Mon, 11 Feb 2008 10:26:06 -0500, Fred Atkinson wrote:
> On Mon, 11 Feb 2008 10:04:39 -0500, Fred Atkinson
><fatkinson@mishmash.com> wrote:
>
>>Well,
>>
>> There was an email in my box from my hosting provider telling
>>me how to fix it and it did. I was told to change the domain name to
>>the IP address.
>>
>> Miraculously, it worked. But I tried that IP address thing
>>once before and it did not work until now.
>>
>> I think my hosting provider found a problem that they
>>corrected and don't want to admit it.
>>
>> So, I'm ready to move on with further development of the
>>script.

[..]
>
> Guess what else? I change the IP address back to the domain
> name and it *still* works. It didn't before.
>
> I am now convinced that there was a problem on my hosting
> provider's end.


Sure smells like a DNS issue to me; they tried the IP, found that it
worked, sent you the email, then someone fixed the DNS after finding out
from your issue how and where it was broken.

I'm glad it's working.

--
Surely the 98% of DNA we share with monkeys must be enough to stop
people from sinking this low.
-- Frossie
  Réponse avec citation
Vieux 11/02/2008, 20h29   #18
Fred Atkinson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Accessing a Database From A Different Website

On Mon, 11 Feb 2008 10:22:36 -0600, "Peter H. Coffin"
<hellsop@ninehells.com> wrote:

>Sure smells like a DNS issue to me; they tried the IP, found that it
>worked, sent you the email, then someone fixed the DNS after finding out
>from your issue how and where it was broken.
>
>I'm glad it's working.


Or it was their problem all along and when they fixed it, they
didn't want to own up to it and just told me to change to the IP
address hoping I wouldn't figure out what really happened. I've seen
telephone companies do that many a time. They don't want to admit to
the customer they found a problem but miraculously it works after they
declared, 'No trouble found'.

I can attest to that after twenty-five years in the telecom
industry.

Thanks, I'm glad, too. Now I can really work on the project
some more.

Regards,




Fred
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h35.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,24937 seconds with 26 queries