Re: Mysql does not answer to Java anymore!!!

From: David Harper (devnull_at_obliquity.u-net.com)
Date: 06/01/04


Date: Tue, 01 Jun 2004 08:46:18 +0100

Robert Kocher wrote:
[SNIP]
> What i found out by myself now, is that it only fails, if i try to
> connect as 'localhost' or by other words, when the socket file is
> used. If i connect as host, let's say with '127.0.0.1:3306' it works.
> The strange thing is, that the socket works with mysqladmin and this
> kind of tools, but not with the java connector. In my eyes, this
> tells me, that the socket is not broken...

The JDBC driver can only connect via the TCP/IP socket. Java has no
knowledge of Unix-style sockets. You need to ensure that your MySQL
server is listening on a TCP/IP socket *and* that you have set the
appropriate privileges (using the GRANT command) to allow client
programs to connect via TCP/IP.

Bear in mind that the mysql command line client will always try to use
Unix-style sockets if you specify the hostname as "localhost", and that
there are circumstances when MySQL may make a distinction between
"localhost" and "127.0.0.1" when it applies the access rules in its
grant tables.

David Harper
Cambridge, England



Relevant Pages

  • Re: HELP: Debian PCMCIA DHCP configuration
    ... Jan 26 22:40:25 localhost dhclient-2.2.x: socket: Address family not ... my kernel configuration was wrong. ... set "Packet socket" to "M" under network options. ... So, rebuild kernel, rebuild pcmcia-modules, install them, reboot....all ...
    (comp.os.linux.networking)
  • Error when executing the library reference echo server example
    ... I've copy/pasted the example of the echo server that comes in the IDLE ... The only change I've made is in the host address ... Have I messed up the example putting 'localhost'? ... import socket ...
    (comp.lang.python)
  • RE: socket object, connection refused ...
    ... especially if you've done this sort of thing in other languages and localhost is used as a reference to 'self'... ... > Subject: Re: socket object, ...
    (comp.lang.python)
  • Re: [Vserver] ssh -X login without "x11uselocalhost no"
    ... >socket, but the addresses refer to locations on the filesystem, ... So yes, it does have a unix socket open, but why can't lsof show it ... sshd tries to connect to /var/run/.nscd_socket but it gets a file not ... If they see "localhost" in the ...
    (SSH)
  • Cannot connect to mysql using socket
    ... A program of mine gives me an error telling that it cannot connect to mysql ... using socket... ... connect using localhost, using sockets. ... Teddy ...
    (perl.beginners)