1

I have a machine with CentOS and mysql server on it (let's call it 'Server'). And another(my desktop) machine with Debian (let's call it 'Desktop'). I tried to launch java program on Desktop machine. Application connects to Server's mysql database without any troubles.

When I finished development of this application (it's still works and connects to DB well) I tried to deploy this app to Server machine. I'v built it the app on the server and tried to launch, using database, which still hosted on Server machine. So now it seems to be local database for my application. But it fails during connection to DB using Server IP address or "localhost" or 127.0.0.1. I have only:

java.sql.SQLException: null,  message from server: "Host '82.192.90.179' is not allowed to connect to this MySQL server". 

In my.cnf file on Server I've set "bind-address=0.0.0.0".

PS:The most interesting thing, I do everything on server using ssh, and if I try to connect to database with "mysql" console tool, it connects OK either with -h82.192.90.179 and without -h option(seems to be localhost as a dafault)

Sachin
  • 3,424
  • 3
  • 21
  • 42
mmmaaak
  • 803
  • 1
  • 18
  • 38
  • You need [*this answer*](http://stackoverflow.com/a/1559992/767881) – Ravinder Reddy Dec 24 '13 at 12:22
  • Ok, I've created a new user, gave him all privileges, flushed all privileges, restarted db server, tried to connect to db with my app localy with new user account - same problem. Tried to connect with this user via mysql command -OK – mmmaaak Dec 24 '13 at 12:30

2 Answers2

0

To know it is permission issue try GRANT ALL ON . TO 'someuser'@%;

http://dev.mysql.com/doc/refman/4.1/en/grant.html Then modify the above statement by replacing % with '82.192.90.179' should work.

Dheerendra Kulkarni
  • 2,728
  • 1
  • 16
  • 18
0

If you feel difficult to connect JDBC means try using mysql workbench MySQL WORKBENCH

1.Make sure you have to host your server code to local server or public server

2.If you host Local Server means it will not work

3.Make sure your server is alive or not

DB_URL = "jdbc:mysql://localhost:portnumber/databasename"

eg.DB_URL = "jdbc:mysql://localhost:3306/cmes"

Maintain Your Session configuration like this in your server side in Web.xml

<session-config>
  <session-timeout>-1</session-timeout> 
  </session-config>
learner
  • 3,092
  • 2
  • 21
  • 33