List:General Discussion« Previous MessageNext Message »
From:Brad Jahnke Date:August 5 2006 4:37pm
Subject:Re: stuck on localhost authentication
View as plain text  
>   insert into user (user,host) values ('jeff','localhost');
>   flush privileges;
>   grant all on databaseName.* to jeff;

jeff = jeff@%

not jeff@localhost

So in your statement you should have used...

grant all on databaseName.* to jeff@localhost;

>    select user,host from user; returns
>         jeff  localhost
> 
> In Java, I use:
>    DriverManager.getConnection( /localhost/databaseName , 'jeff',null );
> 
> when the application tries to connect, DriverManager.getConnection() gets a
> bad handshake error.
> 
> So I set the password in mysql with:
>      set password for jeff = password('xyz');

Similarly... you need to use jeff@localhost

> now select user,host, password from user; returns 2 rows
>             jeff localhost
>             jeff     %      *4232432323
> 
> I think this is the problem - the following getConnection() method is
> directed to the 2nd entry because it has a password, but it's not localhost
> so my localhost-based Java app is denied.
>
> In Java, I use:
>     DriverManager.getConnection( /localhost/tm , 'jeff','xyz' );
> 
> Then I get an authentication failed error.

Connector/J on 'nix types, only works via TCP/IP.  Your app may be trying to
connect via unix socket.  If the user/password fix does not work specify
127.0.0.1 in your connection setting (or even omit host since 127.0.0.1 is
default host value).  Also, make sure your MySQL server is listening via
TCP/IP.  If it is not, be sure to take the necessary security precautions
before doing so, and/or just enable TCP/IP on 127.0.0.1 (the  user
jeff@localhost is valid for connections on 127.0.0.1).




Thread
stuck on localhost authenticationJeff Drew5 Aug
  • Re: stuck on localhost authenticationBrad Jahnke5 Aug