|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
>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. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
> 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 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
> 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 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
On Fri, 02 Nov 2007 23:00:24 -0000, keersarge wrote:
> $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 This looks like a connection failure, not an authorization error of some kind. > > #################### > > 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. @sol means "try a network socket connection" to the mysql libraries, and @localhost means "use the unix socket connection". Which means you're succeeding via the unix socket, but failing via network. This is *in spite of* the usual thinking that "localhost" means "network to 127.0.0.1". > 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. Make sure you've enabled networking. Try telneting to that machine to port 3306. $ telnet 127.0.0.1 3306 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. 8 5.0.33-logû5IQ=xj)-,ERNn_q>|yl0GConnection closed by foreign host. That's a live MySQL server. Note the version number '5.0.33-log'. "Connection refused" is not a MySQL server. -- _ o |/) |
|
![]() |
| Outils de la discussion | |
|
|