stuck on localhost authentication

2006-08-05 Thread Jeff Drew

I'm apologize for posting an apparently simple question, but I'm stuck. I'm
trying to get my java application to connect to mysql on the same server.
The server is redhat with mysql 5.1.11. I'd done this with mysql 4.x in the
distant past.

I add a user with the command:

   insert into user (user,host) values ('jeff','localhost');
   flush privileges;
   grant all on databaseName.* to jeff;

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');

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.

I've also tried:
create user 'jeff'; but that created a   % host entry,
not localhost

What should the user table look like for a localhost user? Which commands
get me there?

Thanks


Re: stuck on localhost authentication

2006-08-05 Thread Brad Jahnke
   insert into user (user,host) values ('jeff','localhost');
   flush privileges;
   grant all on databaseName.* to jeff;

jeff = [EMAIL PROTECTED]

not [EMAIL PROTECTED]

So in your statement you should have used...

grant all on databaseName.* to [EMAIL PROTECTED];

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 [EMAIL PROTECTED]

 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
[EMAIL PROTECTED] is valid for connections on 127.0.0.1).





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]