Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: unable to connect to mysql db on localhost (mysql not listening!)

ilasno

2004-06-09

Replies:

ok, so first i checked out running processes, and myql was there:

229  mysql  /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql
--user=mysql --pid-file ...
234  mysql  /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql
--user=mysql --pid-file ...
235  mysql  /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql
--user=mysql --pid-file ...

but then i used netstat as you indicated, and there's no sign of mysql
listening! here's what showed up:

> netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address       Foreign Address      State     PID/Program name  
tcp     0    0 127.0.0.1:8005       0.0.0.0:*          LISTEN    650/java        
tcp     0    0 0.0.0.0:666         0.0.0.0:*          LISTEN    650/java        
tcp     0    0 0.0.0.0:32177       0.0.0.0:*          LISTEN    309/perl        
tcp     0    0 0.0.0.0:22         0.0.0.0:*          LISTEN    254/sshd        
tcp     0    0 0.0.0.0:139         0.0.0.0:*          LISTEN    248/smbd        
tcp     0    0 0.0.0.0:515         0.0.0.0:*          LISTEN    187/lpd        
tcp     0    0 0.0.0.0:1025        0.0.0.0:*          LISTEN    183/inetd      
tcp     0    0 0.0.0.0:113         0.0.0.0:*          LISTEN    183/inetd      
tcp     0    0 0.0.0.0:220         0.0.0.0:*          LISTEN    183/inetd      
tcp     0    0 0.0.0.0:143         0.0.0.0:*          LISTEN    183/inetd      
tcp     0    0 0.0.0.0:25         0.0.0.0:*          LISTEN    183/inetd      
tcp     0    0 0.0.0.0:37         0.0.0.0:*          LISTEN    183/inetd      
tcp     0    0 0.0.0.0:13         0.0.0.0:*          LISTEN    183/inetd      
tcp     0    0 0.0.0.0:9          0.0.0.0:*          LISTEN    183/inetd      
tcp     0    0 0.0.0.0:1024        0.0.0.0:*          LISTEN    174/rpc.statd    
tcp     0    0 0.0.0.0:111         0.0.0.0:*          LISTEN    104/portmap  


i guess i was assuming that mysql is listening on 3306 by default. so
how do i go about configuring it to do so?

thanks so much,

ilasno






dns4@(protected):

> I think this error message is fairly telling of your problem:
>
> org.apache.commons.dbcp.SQLNestedException: Cannot create
> PoolableConnectionFactory, cause:
> java.sql.SQLException: Cannot connect to MySQL server on
> localhost:3306. Is there a MySQL server running on the machine/port
> you are trying to connect to? (java.net.ConnectException)
>
> Be sure the mysql daemon is running and listening on 3306. Netstat on
> the command line is good for that. Check your man pages for how to
> list listening ports since the command line seems to change from
> platform to platform. On my Linux box, it's netstat -tlnp. Options
> used: -t=show tcp only (no unix sockets), -l=show listening ports
> only, -n=don't resolve ips/ports to names, -p=show owning processes.
>
> I don't think a firewall could cause this problem as most usually
> don't filter /dev/lo (localhost).
>
> Goodluck!
>
> --David
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.