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 > localhost awareness?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
localhost awareness?

Réponse
 
LinkBack Outils de la discussion
Vieux 02/11/2007, 17h33   #1
keersarge
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut localhost awareness?

I am fairly new to MYSQL but I can't locate the answer in either the
config file or my books. It is probably there but hasn't jumped out at me
yet. Two problems actually.

I can access the database with the address of www-data@localhost, but not
with username and the actual hostname - i.e www-data@altair. (No domain -
this is on a private network). The messages says that the DB doesn't exist
on www-data@altair, even though it does.

Not really a problem except that www-data@localhost is not accepted
because the length exceeds 16 characters. www-data@altair is legal, but
MYSQL doesn't map the local hostname..

And the 16 character limit is really surprising, since any user name over
7 characters is invalid, which is most user names. Or am I missing
something?

I can and have worked around the above, but would like to understand some
more of what is happening.

Anybody?

keersarge
  Réponse avec citation
Vieux 02/11/2007, 20h59   #2
Peter H. Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: localhost awareness?

On Fri, 02 Nov 2007 16:33:38 -0000, keersarge wrote:

> I am fairly new to MYSQL but I can't locate the answer in either the
> config file or my books. It is probably there but hasn't jumped out at
> me yet. Two problems actually.
>
> I can access the database with the address of www-data@localhost, but
> not with username and the actual hostname - i.e www-data@altair. (No
> domain - this is on a private network). The messages says that the DB
> doesn't exist on www-data@altair, even though it does.


Quote the message exactly, please. I don't think it is saying what you
think it's saying.

> Not really a problem except that www-data@localhost is not accepted
> because the length exceeds 16 characters. www-data@altair is legal,
> but MYSQL doesn't map the local hostname..
>
> And the 16 character limit is really surprising, since any user name
> over 7 characters is invalid, which is most user names. Or am I
> missing something?


'www-data' is the user name. The rest is host information. The user name
part is limited to 16 characters. The total isn't. One of the user
entries on my system is 'gallery@gehenna.ninehells.com', which is rather
more than 16 characters.

--
I think I'd like to see a Simpsons episode starting up with Bart Simpson
writing "I will not attempt to undermine the Usenet Cabal".
-- J. D. Falk
  Réponse avec citation
Vieux 03/11/2007, 00h00   #3
keersarge
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: localhost awareness?

Ok, my fault. I should have given hard info rather than just questions.
One thing at a time. I am still working on my address length question and
may have the answer - I think.

But back to the connect problem.

>> I can access the database with the address of www-data@localhost, but
>> not with username and the actual hostname - i.e www-data@altair. (No
>> domain - this is on a private network). The messages says that the DB
>> doesn't exist on www-data@altair, even though it does.

>
> Quote the message exactly, please. I don't think it is saying what you
> think it's saying.
>
>

On my learning server, the host name is now 'Sol' with an address of
192.168.0.15 and the hostname is in the /etc/hosts file. I can ping
it from a client on the same private network by name or number so it is
resolving the name ok.

I am calling it with a perl script, but I also tried with a manual line by
line access and get the same stuff.

Here is the perl string calling the connect... #
$dbh = DBI->connect("DBI:mysql:database=draco;host=Sol", "www-data",
"testpass");

and the error in the log...

DBI connect('database=draco;host=Sol','www-data',...) failed: Can't connect
to MySQL server on 'Sol' (111) at /usr/lib/cgi-bin/neworder.pl line 190

####################

But if I change it to the following...
$dbh = DBI->connect("DBI:mysql:database=draco;host=localhost" ,
"www-data", "testpass");

it connects to the DB and no error in the log. Insert and query data just
fine.

#####################

So to recap, www-data@Sol doesn't connect but www-data@localhost does.
The example is straight out of the book, except for my names and addresses
so I think I am missing a configuration line somewhere to resolve a real
address.

Again, using localhost will work fine, but I am trying to learn rather
than write production code, so I try to run down all not-understood
defugalties.

Thanks for the reply
keersarge
  Réponse avec citation
Vieux 03/11/2007, 00h25   #4
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: localhost awareness?

keersarge wrote:
> Ok, my fault. I should have given hard info rather than just
> questions. One thing at a time. I am still working on my address
> length question and may have the answer - I think.
>
> But back to the connect problem.
>
>>> I can access the database with the address of www-data@localhost,
>>> but not with username and the actual hostname - i.e
>>> www-data@altair. (No domain - this is on a private network). The
>>> messages says that the DB doesn't exist on www-data@altair, even
>>> though it does.

>>
>> Quote the message exactly, please. I don't think it is saying what
>> you think it's saying.
>>
>>

> On my learning server, the host name is now 'Sol' with an address of
> 192.168.0.15 and the hostname is in the /etc/hosts file. I can ping
> it from a client on the same private network by name or number so it
> is resolving the name ok.
>
> I am calling it with a perl script, but I also tried with a manual
> line by line access and get the same stuff.
>
> Here is the perl string calling the connect... #
> $dbh = DBI->connect("DBI:mysql:database=draco;host=Sol", "www-data",
> "testpass");
>
> and the error in the log...
>
> DBI connect('database=draco;host=Sol','www-data',...) failed: Can't
> connect to MySQL server on 'Sol' (111) at
> /usr/lib/cgi-bin/neworder.pl line 190
>
> ####################
>
> But if I change it to the following...
> $dbh = DBI->connect("DBI:mysql:database=draco;host=localhost" ,
> "www-data", "testpass");
>
> it connects to the DB and no error in the log. Insert and query data
> just fine.
>
> #####################
>
> So to recap, www-data@Sol doesn't connect but www-data@localhost does.
> The example is straight out of the book, except for my names and
> addresses so I think I am missing a configuration line somewhere to
> resolve a real address.
>
> Again, using localhost will work fine, but I am trying to learn rather
> than write production code, so I try to run down all not-understood
> defugalties.
>
> Thanks for the reply
> keersarge


This sounds like the query discussed recently in this group entitled "Are
these 3 hosts not the same thing?"

But can you post the message that said that the DB did not exist on
www-data@altair, that yo mentioned earlier?


  Réponse avec citation
Vieux 03/11/2007, 00h27   #5
Gordon Burditt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: localhost awareness?

>Ok, my fault. I should have given hard info rather than just questions.
>One thing at a time. I am still working on my address length question and
>may have the answer - I think.
>
>But back to the connect problem.
>
>>> I can access the database with the address of www-data@localhost, but
>>> not with username and the actual hostname - i.e www-data@altair. (No
>>> domain - this is on a private network). The messages says that the DB
>>> doesn't exist on www-data@altair, even though it does.


The error message below does not say the DB doesn't exist, it says
it can't connect to the server. These are very different errors.

>>
>> Quote the message exactly, please. I don't think it is saying what you
>> think it's saying.
>>
>>

>On my learning server, the host name is now 'Sol' with an address of
>192.168.0.15 and the hostname is in the /etc/hosts file. I can ping
>it from a client on the same private network by name or number so it is
>resolving the name ok.


Can you "ping Sol" *from the machine you are running the client on* (Sol)?

>I am calling it with a perl script, but I also tried with a manual line by
>line access and get the same stuff.
>
>Here is the perl string calling the connect... #
> $dbh = DBI->connect("DBI:mysql:database=draco;host=Sol", "www-data",
> "testpass");
>
>and the error in the log...
>
>DBI connect('database=draco;host=Sol','www-data',...) failed: Can't connect
>to MySQL server on 'Sol' (111) at /usr/lib/cgi-bin/neworder.pl line 190
>
>####################
>
>But if I change it to the following...
> $dbh = DBI->connect("DBI:mysql:database=draco;host=localhost" ,
> "www-data", "testpass");


Does it work if you change localhost to 127.0.0.1?

If it works only with localhost (which uses a local socket), and not
with 127.0.0.1 (which uses TCP/IP), this suggests the possibilities:
- You started the MySQL server with --skip-networking.
- You have a firewall preventing incoming connections on the MySQL port
(default 3306).
- The client and the server don't agree on what port to use (if it's the
default on both, they should agree).
- You failed to GRANT permissions to www-data@Sol or www-data@127.0.0.1 .
Although I don't think this is your problem YET, it may be the next one
when you fix the current problem.

>it connects to the DB and no error in the log. Insert and query data just
>fine.
>
>#####################
>
>So to recap, www-data@Sol doesn't connect but www-data@localhost does.
>The example is straight out of the book, except for my names and addresses
>so I think I am missing a configuration line somewhere to resolve a real
>address.

  Réponse avec citation
Vieux 03/11/2007, 15h45   #6
keersarge
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: localhost awareness?

> But can you post the message that said that the DB did not exist on
> www-data@altair, that yo mentioned earlier?


Sorry, no. Not the original. That machine has been reloaded several
times since then. It's a learning machine that I try different stuff on.

I can probably create the same error in its current reincarnation, though.

keersarge
  Réponse avec citation
Vieux 03/11/2007, 16h05   #7
keersarge
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: localhost awareness?

> Can you "ping Sol" *from the machine you are running the client on*
> (Sol)?
>

Yes, no problem. Since it is headless, I also use ssh and scp for
all work on it. My client has Sol in the /etc/hosts file and resolves
the name ok. NFS resolves and works with Sol just fine. So as far as
Linux is concerned, it is a normal server.



> Does it work if you change localhost to 127.0.0.1?
>

Hmmm. I will try that when I get back home.

> If it works only with localhost (which uses a local socket), and not
> with 127.0.0.1 (which uses TCP/IP), this suggests the possibilities: -
> You started the MySQL server with --skip-networking. - You have a
> firewall preventing incoming connections on the MySQL port
> (default 3306).


No firewall between them. All machines are Debian. Mostly Sarge but being
upgraded to Etch.

> - The client and the server don't agree on what port to use (if it's the
> default on both, they should agree).


Being an absolute noob with MYSQL at the moment, I took all defaults on
installation. In fact, I just did an "apt-get install mysql-server" and it
worked. I have changed no conf files yet and have not played with option
files.


> - You failed to GRANT permissions to www-data@Sol or www-data@127.0.0.1


GRANT ALL PRIVILEGES ON *.* TO 'www-data@sol'; and
GRANT ALL PRIVILEGES ON *.* TO 'krf@localhost';

gave me a successful reply on both.

> .
> Although I don't think this is your problem YET, it may be the next
> one when you fix the current problem.
>


I have no doubt that many issues are ahead as I learn, but the books are
good and so is the online advice.

Thanks
keersarge
  Réponse avec citation
Vieux 03/11/2007, 18h28   #8
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: localhost awareness?

keersarge wrote:
>> But can you post the message that said that the DB did not exist on
>> www-data@altair, that yo mentioned earlier?

>
> Sorry, no. Not the original. That machine has been reloaded several
> times since then. It's a learning machine that I try different stuff
> on.
>
> I can probably create the same error in its current reincarnation,
> though.
>
> keersarge


Did you look at the thread that I mentioned in my post?


  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 12h40.


É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,16633 seconds with 16 queries