-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Aug 12, 2002 at 06:57:09PM +0200, Jan Willem Penterman wrote:
> > generally, if you see this problem, your driver is loaded 
> > correctly; however, it is unable to connect to your mysql 
> > server.  i would test this by trying to telnet to port 3306 
> > on localhost and see if you get a connection.  if you don't, 
> > you need to make sure your mysql is allowing connections over 
> > tcp/ip which, if i'm not mistaken, debian has turned off by 
> > default.  look in the /etc/my.cnf or maybe /etc/mysql/my.cnf 
> > or some such for a skip-networking flag and comment it out if 
> > necessary.  restart mysql, try the telnet again.  if it 
> > works, restart tomcat and see if your app works.
> > 
> Very good! You're the 'winner' with the right answer! I was thinking my

yay!  do i get a medal or something?  ;-)

> mysqld setup was ok, since it worked flawlessly with PHP. I guess PHP
> and MySQL have some sort of secret 'marriage', and don't connect over
> TCP/IP? 

probably.

> [off-topic]
> Is that also the reason that php:mysql seems about twice as fast in
> executing queries in comparison to jdbc:mysql? I tested this on my
> Windows machine.
> [/off-topic]

yes.  domain sockets leave out the whole tcp/ip stack and are much
faster.

> However, now I get the following exception: 
> SQLException: Invalid authorization specification: Access denied for
> user: 'root@barrie' (Using password: YES)
> 
> My guess is that I have to config mysqld in a way that it accepts this
> user (of which I'm pretty sure it has the correct login and password)
> from 'barrie' instead of 'localhost' (barrie and localhost essentially
> are the same Debian box). But that's not a question to ask to this
> list...

since we're here...

yes, the problem is that when you connect using the mysql tool on the
command line, the client thinks it is localhost; however, java passes
the host name over the connection and thus you must allow the root
user to connect to mysql from that "host" even thought they are
esentially the same.

as root:

use mysql;
grant all privileges on db.object(s) to root@barrie
identified by 'some_password' [with grant option];
flush privileges;

minor nit - i wouldn't use the root user for these connections.  if
the password is somehow compromised, your *entire* server is
compromised.  if, however, you set up different users for each
database only that particular database will be compromised.

- -- 
Peter Abplanalp

Email:   [EMAIL PROTECTED]
PGP:     pgp.mit.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9V+r/ggA8sH0iRXQRAiEYAJ0fDrn34VaWmFMGXIFqMjzRQH5I6wCguCkx
ldddPETeicqjMdQfm5ZgChc=
=0/8l
-----END PGP SIGNATURE-----

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to