0

I have deployed an application on my Tomcat server with JDBC resources defined. What is puzzling me is that I can connect to the database (which is running locally on the server) only using the server's IP. When I change the resource host to localhost (or 127.0.0.1) then MySQL rejects the connection. I don't want to be connection via the server's IP but rather locally.

What do I do?

Thanks!

2
  • Which Operating System? Are you using a firewall? Which interfaces is MySQL listening on? Commented Mar 22, 2010 at 14:45
  • That is on Ubuntu. I am using firewall but 3306 is open - I can connect to the MySQL server from outside via the server's IP. The problem is that Tomcat only connects to MySQL using the server's IP and not localhost. Commented Mar 24, 2010 at 10:50

1 Answer 1

0

MySQL treats localhost connections and 127.0.0.1 connections and '%' connections differently. Your user needs to be granted access specifically to connect to localhost or 127.0.0.1 or both.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.