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

Reply via email to